Bots scan and attack your SSH 24/7 — Fail2ban automatically bans IPs that fail too many logins.
Install
apt install -y fail2ban
systemctl enable --now fail2ban
SSH config
nano /etc/fail2ban/jail.local
[sshd]
enabled = true
port = ssh
maxretry = 5
bantime = 1h
findtime = 10m
systemctl restart fail2ban
5 failures within 10 min → 1 hour ban.
Check banned IPs
fail2ban-client status sshd
Unban an IP: fail2ban-client set sshd unbanip 1.2.3.4











