Changing the default SSH port from 22 to a custom port can help reduce automated login attempts. This article explains how to change it on a Linux server.
Important Note
Changing the SSH port is not a replacement for strong authentication. Always use strong passwords or SSH keys, and consider a firewall.
Changing the Port
- Log into your server via SSH.
- Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config - Find the line
#Port 22and change it to your desired port, for example:Port 2222 - Save the file and exit.
- Restart the SSH service:
sudo systemctl restart sshd - Update your firewall to allow the new port.
Connecting to the New Port
ssh -p 2222 username@your-server-ip
Need Help?
If you get locked out after changing the port, contact us through the Circle City Servers Support Portal.