Web Hosting & VPS Tips

Unleash Your Server Potential with Expert Insights

Hosting provided by: Cloudways
Free to Try! Up to 40% Off!

Category: VPS Setup

Enable Fail2ban’s recidive jail on Ubuntu to ban repeat offenders—install with
apt install fail2ban
then edit /etc/fail2ban/jail local with
nano /etc/fail2ban/jail.local
:
[recidive]\nenabled = true\nfilter = recidive\nlogpath = /var/log/fail2ban.log\nmaxretry = 5\nfindtime = 86400\nbantime = 604800
Restart with
systemctl restart fail2ban
ensure SSH is open with
ufw allow 22
This bans IPs for 7 days (604800s) if banned 5 times in 24 hours (86400s)—check with
fail2ban-client status recidive
On Linode it protects MySQL and FTP uptime—test with repeated SSH fails expecting long-term bans in /var/log/fail2ban log

Back to All Tips