Fail2ban – how to unbanip on your sshd

IP address unban

Fail2Ban is an intrusion prevention system that protects computer servers from brute-force attacks. It can monitor specific logs and block IP addresses that act like brute-force attacks.

Fail2Ban particularly monitors the number of connection attempts. After 5 failed SSH connection attempts, Fail2Ban will ban the IP address from connecting via SSH for 10 minutes. If this address fails several times, it might be banned permanently until you contact and explain why you are attacking my server.

Unban an IP address

To unblock an IP address, you must first access it from another IP (VPN) address or internet connection than the one that is blocked.

Look at the Fail2Ban log to find out where the IP address was banned.jail

sudo tail /var/log/fail2ban.log 
2019-01-07 16:24:47 fail2ban.filter  [1837]: INFO    [sshd] Found 
2019-01-07 16:24:49 fail2ban.filter  [1837]: INFO    [sshd] Found 
2019-01-07 16:24:51 fail2ban.filter  [1837]: INFO    [sshd] Found 
2019-01-07 16:24:54 fail2ban.filter  [1837]: INFO    [sshd] Found 
2019-01-07 16:24:57 fail2ban.filter  [1837]: INFO    [sshd] Found 
2019-01-07 16:24:57 fail2ban.actions [1837]: NOTICE  [sshd] Ban 
2019-01-07 16:24:57 fail2ban.filter  [1837]: NOTICE  [recidive] Ban

Here, the IP address has been banned in the sshd and recidive jails.

Then use the following commands to unban the IP address.

sudo fail2ban-client set sshd unbanip
sudo fail2ban-client set recidive unbanip


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.