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

Protect your Ubuntu VPS from brute-force attacks by installing Fail2ban—update with
apt update
then install via
apt install fail2ban -y
Start and enable it with
systemctl start fail2ban && systemctl enable fail2ban
Configure SSH protection by editing /etc/fail2ban/jail local—create it with
nano /etc/fail2ban/jail.local
and add:
[sshd]\nenabled = true\nport = 22\nfilter = sshd\nlogpath = /var/log/auth.log\nmaxretry = 5\nbantime = 3600
Restart with
systemctl restart fail2ban
and check status with
fail2ban-client status sshd
—expect \"Banned IP list\" if active Pair with UFW (ufw allow 22) on DigitalOcean to secure SSH MySQL and FTP ensuring uptime by blocking malicious IPs for an hour (3600s)

Back to All Tips