Fail2ban

Hi guys,
I’m wondering how I can enable Fail2ban because it’s disabled when I did a Lynis audit check.
I would be grateful for any help I could get. Thanks! I’m using Fedora 45 I know it’s early but i downloaded it anyway?

If you literally mean “enable” then the command, in a terminal window, would be

sudo systemctl enable fail2ban-service

This is what I got back when I entered what you gave me.
Failed to enable unit: Unit fail2ban-service.service does not exist

I installed fail2ban and here it is so what’s up? This doesn’t make any sense. It’s installed and yet it says doesn’t exist??? sudo systemctl enable fail2ban-service

fail2ban.service - Fail2Ban Service
Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: active (running) since Sun 2026-09-20 11:29:32 PDT; 10min ago
Invocation: 551fdd225680466caf1604207b865515
Docs: man:fail2ban(1)
Process: 1702 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS)
Main PID: 1708 (fail2ban-server)
Tasks: 3 (limit: 38248)
Memory: 15.9M (peak: 18M)
CPU: 162ms
CGroup: /system.slice/fail2ban.service
└─1708 /usr/bin/python3 -sP /usr/bin/fail2ban-server -xf start

Thanks for your help Glenn

I believe that I mis-typed the command.

sudo systemctl enable fail2ban.service

Penguinista@localhost-live:~$ sudo systemctl enable fail2ban.service
Penguinista@localhost-live:~$ It worked thanks Glenn

Warnings (1):
----------------------------
! All jails in Fail2ban are disabled [TOOL-5104]
- Details : /etc/fail2ban/jail.conf
Lynis control TOOL-5104: All fail2ban jails are disabled - CISOfy
Now it shows all jails are disabled. I’m getting confused I thought I enabled it with your help?

As I recall, you now need to do minimal configuration for one or 2 conf files related to fail2ban and then restart fail2ban.service.

It’s been several years since I’ve setup fail2ban.

HowToGeek as rarely let me down.

https://www.howtogeek.com/675010/how-to-secure-your-linux-computer-with-fail2ban/

Hello, I have configured fail2ban on debian server, but I guess in Fedora it must be very similar.

In order to enable a jail, you add it’s name with enable=true it /etc/fail2ban/jail.local

For exemple:

[DEFAULT]
ignoreip = 192.168.0.1

[sshd]
enable = true
mode   = aggressive
bantime = 30d
maxretry = 1

[apache-404]
enabled = true
bantime = 30d
port     = http,https
logpath  = %(apache_access_log)s

[apache-nohome]
enabled = true
bantime = 30d

You can find the names of the jails in jails.conf but it is better to not edit it, since it may be updated by system update