Unblocking a Fail2Ban IP Address

I just spent the best part of an hour messing around with Fail2Ban and having to connect to the problem host via a VPN.

I had been locked out of a host by the IP addresses of both my home and my offices – and it took me a while to realise what was going on!

It also turns out that different versions of fail2ban have different commands for removing bans – but this should work for all of them.

This will let you know the rule number that you need to remove:

iptables -nL -v --line-numbers | grep "your.ip.address"

And this will remove that rule from your IP tables rule set:

iptables -D fail2ban-ssh RULE_NUMBER