[Solved] Fail2Ban says: section 'sshd' already exists

Linux Kernel, Network, and Services configuration.
Locked
Message
Author
jasonnix
Posts: 30
Joined: 2023-12-04 11:30
Has thanked: 2 times

[Solved] Fail2Ban says: section 'sshd' already exists

#1 Post by jasonnix »

Hello,
I installed Fail2Ban.And its service was not running. The service ran successfully when I added the following lines to the beginning of the configuration file:

Code: Select all

[sshd]
enabled = true
Now I want to configure Fail2Ban for SSH service and my settings are as follows:

Code: Select all

[sshd]
port    = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
maxretry  = 2
findtime  = 10
bantime   = 4w
When I restart the Fail2Ban service, I see the following error message:
[1313]: ERROR Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 275]: section 'sshd' already exists
How to solve it?

Thank you.
Last edited by jasonnix on 2024-02-26 16:55, edited 2 times in total.

jasonnix
Posts: 30
Joined: 2023-12-04 11:30
Has thanked: 2 times

Re: Fail2Ban says: section 'sshd' already exists

#2 Post by jasonnix »

Hello,
I commented these two line:

Code: Select all

[sshd]
enabled = true
Then I changed the configuration as below:

Code: Select all

[sshd]
enabled = true
port    = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
maxretry  = 2
findtime  = 10
bantime   = 4w
After it, I got the error message Failed during configuration: Have not found any log file for sshd jail.
How to solve it?

Aki
Global Moderator
Global Moderator
Posts: 4342
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 127 times
Been thanked: 585 times

Re: Fail2Ban says: section 'sshd' already exists

#3 Post by Aki »

Thread closed as the topic in the subject of the first post has been resolved.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Locked