Quick answer
How do you install fail2ban on a VPS?
To install fail2ban on a VPS, run apt install fail2ban python3-systemd, write a jail.local that turns on the sshd jail with the systemd backend, then restart the service. A ban of 1 hour after 5 failures is a sane start. JadeKVM servers run Debian or Ubuntu images where this works as shown.
In brief
- jail.local, never jail.conf: package updates overwrite jail.conf.
- systemd backend: Debian 13 has no /var/log/auth.log by default, so fail2ban reads the journal.
- Whitelist yourself: put your fixed home or office IP in ignoreip.
- Check with
fail2ban-client status sshdto see failures and bans.
How to install fail2ban on a VPS in 5 steps?
Run the commands as a sudo user. Keep a second SSH window open while you test.
Install the packages
Run
sudo apt install fail2ban python3-systemd. The second package lets fail2ban read the journal.Create jail.local
Write the sshd jail with backend = systemd, maxretry, findtime and bantime.
Add your own address
Put your fixed IP in ignoreip, so a typo never bans you.
Restart and enable
Run
sudo systemctl enable --now fail2ban, thensudo systemctl restart fail2banafter each change.Check the jail
Run
sudo fail2ban-client status sshdand read the failed and banned counters.
Which fail2ban settings matter most?
| Setting | Starting value | What it does | Tune it when |
|---|---|---|---|
| backend | systemd | Reads SSH failures from the journal | Never on Debian 13 or Ubuntu 24.04 |
| maxretry | 5 | Failures before a ban | Lower to 3 with keys-only login |
| findtime | 10m | Window in which failures count | Raise for slow, patient bots |
| bantime | 1h | Length of a ban | Raise to 1d for repeat offenders |
| ignoreip | 127.0.0.1/8 ::1 plus your IP | Addresses never banned | You have a fixed address |
Why does fail2ban need the systemd backend on Debian 13?
Debian 13 logs SSH to the systemd journal and ships no rsyslog, so the classic auth.log file is missing. A jail that watches a missing file fails to start. With backend = systemd, fail2ban queries the journal directly. Ubuntu 24.04 still writes auth.log, but the journal works there too, so one config fits both.
The file below is complete for a server that only exposes SSH. Change 198.51.100.7 to your own fixed address, or remove it if your address changes.
[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 198.51.100.7
bantime = 1h
findtime = 10m
maxretry = 5
[sshd]
enabled = true
backend = systemdHow do you check bans and unban an address?
Use fail2ban-client: status shows the counters, and unban removes one address. Bans become firewall rules, so they hold even if UFW allows SSH. A ban ends by itself after bantime.
On a new public server, the banned list often fills within a day. That is normal background noise. It also shows why keys-only login matters more than any ban.
sudo fail2ban-client status
sudo fail2ban-client status sshd
sudo fail2ban-client set sshd unbanip 203.0.113.55
sudo journalctl -u fail2ban --since todayWhich is better on a VPS: fail2ban or UFW limit?
Use both: they act at different layers. ufw limit slows any address that opens six connections in 30 seconds. Fail2ban reads real login failures and bans for longer. The guide on how to set up a UFW firewall on a VPS shows the limit rule.
JadeKVM read WonderNetwork's public pings on 16 November 2026: Tokyo sits 35 ms from Seoul and 31 ms from Taipei. Latency figures on JadeKVM pages are public averages measured by WonderNetwork between its own servers on 16 November 2026; they show how far apart the cities sit on the network, not a promise about any one JadeKVM server. Neither tool changes those round trips.
Can fail2ban protect nginx or WordPress too?
Yes, with extra jails such as nginx-http-auth or a filter for wp-login.php. Each jail needs the log file of that service and a matching filter in /etc/fail2ban/filter.d/. Start with sshd only; add web jails once the site runs, as in how to install WordPress on a VPS.
Questions about fail2ban on a VPS
Do I still need fail2ban with SSH keys only?
It is less critical, since passwords cannot be guessed. It still trims log noise and slows scans. On a JadeKVM server with a key pasted at checkout, it is a second layer.
Why does fail2ban fail to start on Debian 13?
Usually because the sshd jail looks for /var/log/auth.log. Add backend = systemd and install python3-systemd.
What is the best bantime for a VPS in 2026?
One hour is a good start. Enable the recidive jail to ban repeat offenders for a week.
Does fail2ban work with IPv6?
Yes, recent versions ban IPv6 addresses too. Debian 13 and Ubuntu 24.04 ship versions with IPv6 support.
Can I ban myself?
Yes, by typing wrong too often. Add your fixed IP to ignoreip, or unban yourself from another address.
Verdict
- Install fail2ban with python3-systemd and backend = systemd: that is what works on Debian 13 and Ubuntu 24.04.
- Pair it with UFW and keys-only login; fail2ban is a filter, not a lock.
Sources (4)
- Fail2ban project and documentation — Fail2ban (read 2026-11-16)
- fail2ban package, Debian 13 (trixie) — Debian (read 2026-11-16)
- Security, Ubuntu Server documentation — Canonical (read 2026-11-16)
- WonderNetwork: pings from Tokyo wondernetwork.com/pings/Tokyo — WonderNetwork (read 2026-11-16)
Run fail2ban on a Tokyo server
Pendant in Tokyo costs $4.50 a month on 12 months, with your SSH key in place.
- Built by a person, 1 hour at most after confirmation
- Lost days credited back if a server cannot be delivered
- Pay in BTC, XMR, USDT, USDC, ETH, SOL or LTC
- DomaineGoat LLC · Panama