About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
If fail2ban has banned your own address, you cannot reach the server from that address, so the command must run from somewhere else: the provider's console, a second network, or a session already on the server. Find the jail with fail2ban-client banned and your address, then unban with fail2ban-client set jailname unbanip address. The ban comes back if the same failures continue, so find what caused them and put your address on the ignore list in jail.local.
What the symptom means
fail2ban reads log files or the journal and counts failures with a filter. A jail combines a filter with actions that ban and unban. The jail.conf manual defines the three numbers that decide a ban: maxretry is the "number of failures that have to occur in the last findtime seconds to ban the IP"; findtime is the time interval before now in which failures count; bantime is the "effective ban duration".
The manual page does not give default values for these three, so read your own with the commands below.
Three protections exist. ignoreself is, in the manual's words, a boolean "(default true)" that prevents the banning of the host's own addresses. ignoreip is a "list of IPs not to ban". It can include a CIDR mask or a DNS name, and a file prefixed with file:. ignorecommand runs a command to decide whether an address should not be banned. None of them covers a remote administrator's address unless you add it.
Bans are stored. The dbfile setting says the persistent data "allows bans to be reinstated and continue reading log files from the last read position when fail2ban is restarted". A restart of fail2ban is therefore not a reliable way to lift a ban, and the manual describes stop as stopping all jails and terminating the server, so while it is stopped the jails are not running. The manual does not say what happens to existing firewall rules at that point.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| Failed logins from your own address (typed wrong, old key, wrong user) | Blocked soon after several failures | fail2ban-client banned lists a jail for your address |
| An automated job using an old password or key (backup, monitoring, script) | Blocked at intervals, and it returns after each unban | Failures in the service log at regular intervals from the job's host |
| Many people behind one public address | Everyone from the office is blocked at once | The address in the ban is the office or provider address |
| The address the server sees is not the one you expect | Ban shows a different address from your machine | Compare with the address shown in the service log |
No ignoreip entry for a trusted address |
Same address banned again | fail2ban-client get jailname ignoreip does not list it |
Prove the cause before changing anything
All of these are read-only. You need a shell on the server. If SSH from your address is blocked, use the provider's console, a second network (a phone hotspot, a bastion host) or a session that was already open.
1. List the jails.
fail2ban-client status
The manual describes status as getting the current status of the server.
2. Find which jails have your address.
fail2ban-client banned 198.51.100.25
Replace the documentation address with yours. The manual says banned IP returns the list of jails where the given address is banned. For one jail, fail2ban-client get jailname banned 198.51.100.25 returns 1 if the address is banned there and 0 otherwise.
3. Read the jail's state.
fail2ban-client status jailname
4. Read the ignore list for the jail.
fail2ban-client get jailname ignoreip
fail2ban-client get jailname ignoreself
5. Find the failures that led to the ban. Read the service log that the jail watches. fail2ban-client get jailname logpath returns the monitored files. If the jail uses the journal, fail2ban-client get jailname journalmatch returns the journal match. The failures that came from your address show what is going wrong: a user name, a key, or a job.
6. Save what you found. Write the output of steps 2 to 4 into a dated note on the server so that you know the state before any change.
Fix
Unban the address
Disruptive step: unbanning lets that address try to reach the service again. If the address really was attacking, it will fail again and be banned again after maxretry failures. Confirm step 5 first, and keep the saved note.
fail2ban-client set jailname unbanip 198.51.100.25
The manual describes unbanip as manually Unban <IP> in <JAIL>. If you do not know the jail, fail2ban-client unban 198.51.100.25 is described as unbanning the address "in all jails and database". To back out, ban it again with fail2ban-client set jailname banip 198.51.100.25.
Do not use the command that unbans every address. It is not needed for one address and it releases real attackers.
Stop the cause
Fix the script's credential, the key, or the user name that keeps failing. Until that is fixed, adding an address to the ignore list only hides the failures from fail2ban, and they still show in the service log. If many users share one public address, the ignore list may be the right answer for that address.
Add the address to the ignore list
Use a lasting entry in a .local file. The manual says .conf files "should remain unchanged to ease upgrades" and customisations belong in .local files, which are read after the .conf files. In the .local file, you specify "only the settings you would like to change".
Disruptive step: the ignore list tells fail2ban never to ban the address, so anyone using it can try passwords without limit. Use a single address you control, not a network or a name you do not control. A DNS name is accepted, but then whoever controls that name decides who is exempt.
First find out whether the file exists, so that you pick the right back-out below:
ls -l /etc/fail2ban/jail.local
If it exists, save it under a dated name:
cp -a /etc/fail2ban/jail.local /etc/fail2ban/jail.local.2026-11-20
Then add the entry to the [DEFAULT] section (which applies to every jail) or to one jail's section:
[DEFAULT]
ignoreip = 203.0.113.50
If the file already has a [DEFAULT] section, add the line there. Before you write the line, copy the current value from step 4 (fail2ban-client get jailname ignoreip), because the new line replaces earlier values. Keep every existing entry in the same line, separated by spaces (the manual says multi-value items are separated by spaces). The manual says settings in the file parsed later take precedence over identical entries in earlier files, so this line replaces any ignoreip set earlier in jail.conf or jail.d/*.conf. A jail section that sets its own ignoreip overrides [DEFAULT] for that jail, so read the value with fail2ban-client get jailname ignoreip after the reload.
Disruptive step: reloading fail2ban makes the running server re-read every jail's configuration, so a configuration that the test accepts but a jail rejects would show in fail2ban-client status as a missing jail.
Check the configuration, then reload:
fail2ban-client -t
fail2ban-client reload
The manual describes -t as "test configuration" and reload as reloading the configuration without restarting the server. Run fail2ban-client status after the reload and compare the jail list with the one you saved.
To back out, if you saved a copy, restore it under the name you saved it, then test and reload:
cp -a /etc/fail2ban/jail.local.2026-11-20 /etc/fail2ban/jail.local
fail2ban-client -t
fail2ban-client reload
If jail.local did not exist before your change, delete that one file by its full name, then run fail2ban-client -t and fail2ban-client reload.
Add the address now, without a file change
First print and save the jail's current list with fail2ban-client get jailname ignoreip. Disruptive step: fail2ban-client set jailname addignoreip 203.0.113.50 adds the address to that jail's ignore list straight away, so that address is never banned in that jail. To back out, run fail2ban-client set jailname delignoreip 203.0.113.50, then print the list again and compare it with the saved copy. The manual does not say whether the change survives a restart, so also put the lasting entry in jail.local.
Example (illustrative): an administrator on 203.0.113.50 is locked out of SSH on web01 after a deployment script tries an old key six times. From the provider's console, fail2ban-client banned 203.0.113.50 names one jail. The administrator saves the output of status jailname and get jailname ignoreip, runs set jailname unbanip 203.0.113.50, and fixes the key in the script. Then a single ignoreip = 203.0.113.50 is added to jail.local after a dated copy of that file, fail2ban-client -t reports no error, and fail2ban-client reload applies it.
Confirm the fix
fail2ban-client banned 203.0.113.50(your address) lists no jail.fail2ban-client get jailname ignoreipshows the address after the reload.- SSH or the affected service works from the address.
- The log shows no new failures from the job or user that caused the ban.
What to watch afterwards
- Check the service log for failures from automation and fix credentials when passwords or keys change.
- If the office address changes, update the ignore list and remove the old address.
- Keep an out-of-band way into the server (console or a second address) so a ban never blocks all access.
- Read
fail2ban-client -dafter changes; the manual describes-das dumping the configuration, and--dpas a more readable form.
Read next
Related articles you may want next.
- TroubleshootingLinux account locked after failed logins: read and reset pam_faillockLinux refuses the right password after failed logins? Read the pam_faillock record, find the source of the failures, then reset one user safely.Read article
- TroubleshootingChanged sshd_config and now SSH says "Connection refused" on port 22: prevent it and recoverSSH Connection refused after editing sshd_config? Use the console, run sshd -t, check the port, ssh.socket and bind errors. How to avoid it next time.Read article
- TroubleshootingSSH "Permission denied (publickey)": what the server log says and what to fixSSH says Permission denied (publickey)? Read the sshd log line, then check authorized_keys modes, StrictModes, AllowUsers and accepted key algorithms.Read article
Risks and limits
- These commands have not been run or lab-tested.
- Jail names, default values and the ban action depend on the packaging. The jail manual names
iptables-multiportas the defaultbanaction, but your host may use another. - An ignored address is never banned, so an attacker or a compromised machine at that address is not slowed.
- The manual pages are the Fail2Ban project's, as rendered by Arch Linux; options may differ on older versions.
Sources
- fail2ban-client(1) — Fail2Ban project manual page as rendered by Arch Linux, August 2026, accessed 20 November 2026
- jail.conf(5) — Fail2Ban project manual page as rendered by Arch Linux, November 2015, accessed 20 November 2026
- cp(1) — GNU coreutils 9.11 manual page, April 2026, accessed 20 November 2026
This article was originally published on .