Ubuntu
Sometimes fail2ban doesn’t start. This is usually because systemd is having a bad day.
First, connect to your server. (If you’re using a DigitalOcean Droplet their docs are here).
Then, make sure systemd knows fail2ban should be enabled:
root@example:~# systemctl enable fail2ban Synchronizing state of fail2ban.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable fail2ban Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /lib/systemd/system/fail2ban.service. root@example:~#
Next, check that the fail2ban configuration is OK:
root@example:~# fail2ban-client --test OK: configuration test is successful root@example:~#
Finally, start fail2ban and check it’s running:
root@example:~# systemctl start fail2ban root@example:~# systemctl status fail2ban ● fail2ban.service - Fail2Ban Service Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2023-05-30 17:04:59 UTC; 18s ago Docs: man:fail2ban(1) Main PID: 5471 (fail2ban-server) Tasks: 9 (limit: 1115) Memory: 12.0M CPU: 257ms CGroup: /system.slice/fail2ban.service └─5471 /usr/bin/python3 /usr/bin/fail2ban-server -xf start May 30 17:04:59 example systemd[1]: Started Fail2Ban Service. May 30 17:04:59 example fail2ban-server[5471]: Server ready root@example:~#