Install Fail2ban on Raspberry Pi

Fail2ban is a tools for security. Is use to ban malicious login, too many bad login with bad password.

1. Update system

sudo apt update
sudo apt upgrade

2. Install Fail2Ban

sudo apt install fail2ban -y

3. Copy generated config

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

4. Edit local config with Nano

sudo nano /etc/fail2ban/jail.local

5. Add after [SSHD]

enabled = true
filter = sshd
port = ssh
banaction = iptables-multiport
bantime = 1800
maxretry = 3



bantime = 1800 – time in second for ban

maxretry = 3 – number of  maxim try to login

6. Save file, and restart services.

sudo service fail2ban restart