Protecting Your VPS with Fail2Ban

Protecting Your VPS with Fail2Ban

Fail2Ban helps protect your VPS from brute-force attacks by banning IPs with too many failed login attempts.

Step 1: Install Fail2Ban

sudo apt update && sudo apt install fail2ban -y

Step 2: Configure Fail2Ban

Create a local jail configuration:

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

Edit jail.local and set rules:

[sshd]
enabled = true
port = 2222
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 600

Step 3: Restart Fail2Ban

sudo systemctl restart fail2ban

Step 4: Check Status

sudo fail2ban-client status sshd

✅ Now your VPS is protected from repeated login attempts.

  • VPS Security, Brute Force Protection, Fail2Ban
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

How to Set Up a Firewall (UFW) on Your VPS

How to Secure Your VPS with a Firewall A firewall is essential for protecting your VPS from...

Securing SSH Access on Your VPS

Securing SSH Access on Your VPS SSH is the primary way to access your VPS. By hardening SSH,...

Securing Your VPS with UFW Firewall

Securing Your VPS with UFW Firewall UFW (Uncomplicated Firewall) helps you manage firewall...

Disable Root Login for Better VPS Security

Disable Root Login for Better VPS Security Allowing direct root login via SSH is risky and...

Change Default SSH Port to Prevent Attacks

Change Default SSH Port to Prevent Attacks By default, SSH runs on port 22, which is the...