Basics

How to Unban an IP in Fail2ban (and See Who's Banned)

2 min read

Banned the wrong IP (maybe your own)? You can unban without restarting Fail2ban.

1. See which jails exist

sudo fail2ban-client status

2. See banned IPs in a jail

sudo fail2ban-client status sshd

Look for the Banned IP list: line.

3. Unban a single IP

sudo fail2ban-client set sshd unbanip 203.0.113.7

On Fail2ban 0.11+ you can let it find the jail automatically:

sudo fail2ban-client unban 203.0.113.7

4. Unban everything (0.11+)

sudo fail2ban-client unban --all

5. Locked yourself out of SSH?

If you can still reach a console (cloud provider web console, IPMI/KVM, or a second open session), run the unban above. Then add your IP to ignoreip so it can’t happen again, and reload:

sudo fail2ban-client reload

Note: unbanning removes the firewall rule immediately, but if the IP keeps failing it will be re-banned. Whitelist it with ignoreip if it should never be banned.

Open the full version (with copy buttons) ↗

← All recipes