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

Integrate Fail2ban with UFW on Ubuntu—install both with
apt install fail2ban ufw
then edit /etc/fail2ban/action d/ufw conf with
nano /etc/fail2ban/action.d/ufw.conf
:
[Definition]\nactionstart =\nactionstop =\nactioncheck =\nactionban = ufw insert 1 deny from \nactionunban = ufw delete deny from 
Update /etc/fail2ban/jail local:
[sshd]\nenabled = true\nport = 22\naction = ufw\nlogpath = /var/log/auth.log\nmaxretry = 5
Restart with
systemctl restart fail2ban
On Linode test with SSH attempts—check
ufw status
for \"DENY\" rules and
fail2ban-client status sshd
for bans ensuring MySQL and FTP uptime with layered security

Back to All Tips