-
Install:
sudo apt install fail2ban
orsudo yum install fail2ban
-
Copy default config:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
-
Edit jail.local and enable
sshd
protection -
Start Fail2Ban:
sudo systemctl start fail2ban
-
Enable at boot:
sudo systemctl enable fail2ban
Fail2Ban automatically blocks IPs after repeated failed login attempts.