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

Whitelist IPs in Fail2ban on Ubuntu—install with
apt install fail2ban
then edit /etc/fail2ban/jail local with
nano /etc/fail2ban/jail.local
:
[sshd]\nenabled = true\nport = 22\nfilter = sshd\nlogpath = /var/log/auth.log\nmaxretry = 5\nbantime = 3600\nignoreip = 192.168.1.100 10.0.0.1
Restart with
systemctl restart fail2ban
open SSH with
ufw allow 22
Test from a non-whitelisted IP—check
fail2ban-client status sshd
for bans while 192 168 1 100 stays unbanned On Linode this protects MySQL and FTP—verify with
fail2ban-client get sshd ignoreip
ensuring uptime for trusted IPs

Back to All Tips