Protect your Linux server with Fail2ban — automatically ban IPs after failed login attempts.
Step 1: Install Fail2ban
Install with apt install fail2ban (Debian/Ubuntu) or dnf install fail2ban (RHEL/AlmaLinux).

Step 2: Enable and Start the Service
Run systemctl enable --now fail2ban to start Fail2ban on boot.

Step 3: Check Banned IPs
Use fail2ban-client status sshd to view the SSH jail and banned IP addresses.

# /etc/fail2ban/jail.local
[sshd]
enabled = true
maxretry = 3
bantime = 3600
Terminal screenshots are original illustrations created for Gnome IT Solutions (blog.gnomeitsolutions.com).
