Changing the SSH Port for Dedicated Servers
This article covers changing the SSH Port for Dedicated Servers.
There are several steps to take when changing the SSH Port.
Log into the server in question as root through SSH.
Find and enter the sshd_config file for editing.
Once you are in the sshd_config file, search for the current SSH Port number (using
Port setting with the desired port number. For this example, we will use port 2222.
Once completed save the file and exit back into the server. (For nano, use
y, then hit the Enter key)
Next, go into the firewall settings and update the incoming TCP ports to allow the new port if it is not already allowed.
Find the incoming TCP ports, look for the requested SSH port number. If it is not there, add the new port to the list. Once complete, save and close the file.
Now save the settings for the firewall.
Then restart the SSH services on the server.
You should then try disconnecting and reconnecting to the server with the new port number to verify the changes you've made actually work.