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

Secure a custom SSH port with Fail2ban on Ubuntu—change port to 2222 in /etc/ssh/sshd_config with
nano /etc/ssh/sshd_config
setting Port 2222 then restart SSH with
systemctl restart sshd
Install Fail2ban with
apt install fail2ban
edit /etc/fail2ban/jail local:
[sshd]\nenabled = true\nport = 2222\nfilter = sshd\nlogpath = /var/log/auth.log\nmaxretry = 5\nbantime = 3600
Restart with
systemctl restart fail2ban
open port with
ufw allow 2222
On Linode test with
ssh -p 2222 user@ip
—check bans with
fail2ban-client status sshd
ensuring MySQL and FTP uptime with custom port security

Back to All Tips