Introduction
rnFail2Ban is a powerful tool that protects your VPS from brute-force attacks by monitoring log files and banning suspicious IPs automatically. This guide shows you how to install and configure Fail2Ban for better server security.rn
Step-by-step Guide
rn
rn - Update your system and install Fail2Banrn
rn sudo apt updaternsudo apt install fail2ban rn
rn rn - Copy the default configuration filern
rn sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local rn
rn rn - Edit the configuration to protect SSHrn
rn sudo nano /etc/fail2ban/jail.local rn - Look for the [sshd] section and make sure it looks like this:
rn [sshd]rnenabled = truernport = sshrnfilter = sshdrnlogpath = /var/log/auth.logrnmaxretry = 5rnbantime = 3600 rn
rn rn - Restart and enable Fail2Ban
rn - Check Fail2Ban statusrn
rn sudo fail2ban-client statusrnsudo fail2ban-client status sshd rn
rn rn - RecommendationsrnAdjust maxretry and bantime to fit your security needs.rnRegularly check the Fail2Ban logs for blocked IPs.rnYou can protect other services (like Apache, Nginx, etc.) by enabling their respective jails in the config.
rn
rn
Call To ActionrnWant a secure VPS with full root access? Check out our hosting plans!
https://xernode.com/#pricingrnrn
Related Guidesrn
How to Enable Firewall (UFW) in Ubunturn
How to Set Up Automatic Backups in Linux