Set up fail2ban in 5 minutes
Auto-ban IPs that fail too many SSH login attempts. The single highest-ROI security tool for VPS.
fail2ban tails system log files and bans source IPs that fail authentication too many times in a row. Default config is good for SSH; custom jails extend to nginx, Postfix, and other services.
Install
On Ubuntu/Debian:
apt update && apt install fail2ban -yOn AlmaLinux/Rocky:
dnf install fail2ban -yConfigure
Create /etc/fail2ban/jail.local (the .local file overrides /etc/fail2ban/jail.conf which gets replaced on package upgrade):
[DEFAULT]
bantime = 3600
findtime = 600
maxretry = 3[sshd] enabled = true port = 22222 # match your custom SSH port
This bans IPs for 1 hour after 3 failed attempts in 10 minutes.
Enable and start
systemctl enable fail2ban
systemctl start fail2banVerify status:
fail2ban-client status sshdWhitelist your own IP
If you have a static home or office IP, add it to the ignoreip list to avoid locking yourself out:
[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 1.2.3.4Deploy your first offshore server in 60 seconds.
Anonymous signup. Bitcoin & Monero accepted. Provisioned across 8 jurisdictions.
No credit card required · 7-day money-back guarantee