Knowledge Base

(Debian) How to Change SSH Port

Open server console and login as root user, or open SSH and login as an existing user with root privileges

Open the SSH configuration file using a text editor:
nano /etc/ssh/sshd_config

Find the line '#Port 22' or 'Port 22', uncomment it by removing the hash, and change 22 to your preferred port number (e.g., 2222). Save and close the file.

If you have a firewall enabled, allow the new port:
ufw allow 2222/tcp

Restart the SSH service to apply the changes:
systemctl restart ssh

If you have Premium OS support from us, we can configure the Firewall for you.

Please rate this article to help us improve our Knowledge Base.

0 0