I'm using fail2ban on a server and i'm wondering how to unban an ip properly

I know I can work with IPTables directly: iptables -D fail2ban-ssh <number>

But is there not a way to do it with the fail2ban-client ?

In the manuals it states something like: fail2ban-client get ssh actionunban <IP> . But they don't do it

Also, I don't want to /etc/init.d/fail2ban restart as that would lose all the bans in the list.

Best Answer


With Fail2Ban before v0.8.8.

fail2ban-client get YOURJAILNAMEHERE actionunban IPADDRESSHERE

With Fail2Ban v0.8.8 and later.

fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE

The tough part is to find the right prison

  1. Use iptables -L -n to find the rule name...
  2. ...then use fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g' to get the actual jail names. The rule name and jail name may not be the same but it should be clear which one is related to which.