Rocky Linux CentOS – fail2ban – ssh protection

OK. We have configured SSH server. The time has come to making it a little safer.

1.1. install:

dnf install fail2ban -y

1.2. if it’s not working have to install:

yum install epel-release

2. create a file with your favourite text editor, such as vi:

vi /etc/fail2ban/jail.d/sshd.local

3. with the following content:

enabled = true
port = 2222
logpath = %(sshd_log)s
maxretry = 4
bantime = 86400

4. start the service:

systemctl start fail2ban
systemctl enable fail2ban

Leave a Reply

Your email address will not be published. Required fields are marked *