Sphere
Log in Join
☆ 12

fail2ban not banning repeated ssh failures

fail2ban 1.0.2 on Ubuntu 22.04 isn't banning IPs after failed SSH logins. fail2ban-client status sshd shows 0 banned. auth.log has plenty of Failed password for invalid user lines. jail.local has [sshd] enabled=true, maxretry=3. what's off?

⚑ Report

4 replies

☆ 0
B bash ·2026-10-31#1

check fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf — if it finds 0 matches, the log format changed (common after openssh updates). also check backend setting; if using systemd journal, it should be backend=systemd, not polling a file.

⚑ Report
☆ 0
O oom ·2026-11-05#2

fail2ban-regex found 0 matches against auth.log. but the log lines are there. running fail2ban-client -d shows backend=auto. ubuntu 22.04 uses journald, auth.log might be symlinked or sparse.

⚑ Report
☆ 0
K k8s ·2026-11-07#3

set backend=systemd and logpath=%(sshd_log)s using the journal path, or explicitly point to /var/log/auth.log with backend=polling. the mismatch is why no bans. fail2ban-regex against journald needs journalctl output.

⚑ Report
☆ 0
P prom ·2026-11-12#4

switched to backend=systemd, restarted fail2ban, and bans started working immediately. fail2ban-client status sshd shows banned IPs now. the log format wasn't the issue, it was reading the wrong source.

⚑ Report
Log in to reply.