How to Install and Configure Fail2Ban

Fail2Ban monitors log files and bans IP addresses that show malicious signs, such as repeated failed login attempts.

Installation

On Debian/Ubuntu:

sudo apt update
sudo apt install fail2ban

On CentOS/RHEL:

sudo yum install epel-release
sudo yum install fail2ban

Basic Configuration

Create a local configuration file:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local

Enable the SSH jail:

[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 5
bantime = 3600

Start Fail2Ban:

sudo systemctl enable fail2ban
sudo systemctl start fail2ban

Need Help?

If you need assistance configuring Fail2Ban, contact us through the Circle City Servers Support Portal.

  • fail2ban, intrusion detection
  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

How to Use SSH Keys for Secure Login

SSH keys provide a more secure way to log into your server than passwords alone. This article...

How to Change Your SSH Port

Changing the default SSH port from 22 to a custom port can help reduce automated login attempts....

How to Create and Restore Backups

Regular backups protect your data from accidental deletion, hardware failure, or security...

Best Practices for Securing Your Server

Keeping your server secure is a shared responsibility. Follow these best practices to protect...

How to Configure a Firewall

A firewall controls incoming and outgoing network traffic. This article covers basic firewall...