fbpx

How to check and remove IPs from fail2ban

Background

Fail2ban is a really powerful utility and can help you out of a bind. The problem is the syntax – it’s changed and when you really need it on occasion it’s not entirely memorable. So here is a quick HOWTO to get you out of a bind.

Use the command sequence below to check for a banned IP address:

sudo zgrep 'Ban' /var/log/fail2ban.log* | grep x.y.150.94
/var/log/fail2ban.log:2020-11-20 08:18:32,558 fail2ban.actions [1547]: NOTICE [sshd] Ban x.y.150.94

Then remove it like so

fail2ban-client set sshd unbanip x.y.150.94

Then check if it worked like so:

sudo zgrep -i 'Unban' /var/log/fail2ban.log* | grep x.y.150.94
/var/log/fail2ban.log:2020-11-20 08:27:43,762 fail2ban.actions [1547]: NOTICE [sshd] Unban x.y.150.94

Look for Unban

References

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

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

Scroll to Top