What is Fail2Ban?

Fail2Ban scans system log files and bans IPs that show malicious behavior — like too many failed login attempts.

Evans

Last Update hace 2 meses

Installation & Setup Instructions

 a) For RHEL / AlmaLinux / Rocky Linux (8 or 9)

💡 Ensure EPEL repository is enabled before installing Fail2Ban.

  1. Enable EPEL Repo

2. Install Fail2Ban

3. Enable and Start the Service

4. Check Status

sudo systemctl status fail2ban
b) For Ubuntu (18.04, 20.04, 22.04, or newer)
  1. Update Package List

2. Install Fail2Ban

3. Enable and Start the Service

4. Check Status


Basic Configuration (All Systems)

Fail2Ban's default config is located in /etc/fail2ban/jail.conf, but do not edit it directly. Instead, create a local override:

Or better:

Example: Enable SSH Protection

Add or ensure the following block exists:

You can change maxretry or add bantime = 600 (seconds) to customize.

Monitoring Fail2Ban

1. Check Banned IPs

2. Ban or Unban IP Manually

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us