Changing SSH port in Centos
The discussion below refers to any CentOS Linux servers on Apps4Rent’s Hyper-V Virtual Dedicated Server platform
To change the SSH port you need to update your sshd_config file and finally reload the configuration so that it can take effect.
NOTE: The steps provided here are on a best effort basis. If you change the port incorrectly then you would loose connectivity to your server via SSH. In such a scenario you will need to contact support. For unmanaged servers; you will be billed on an hourly basis. We will then try to reset the port and pass the details to you.
This example will assist you in changing the ssh port to nnnn<port number that you wish to use; Please replace nnnn with valid port number>
1. From your terminal session, edit /etc/ssh/sshd_config
2. Look for the following line:
3. Change the line so it looks like this:
Port nnnn <port number that you wish>
4. Save and close the file
5. Load the new configuration by using the service command
service sshd restart
NOTE: This command with restart sshd; and as a result you will loosed the existing connectivity to the current ssh connection. You need to open a new session of ssh and use the right ports to connect to server.
$ ssh firstname.lastname@example.org -p nnnn <port number chosen in step 3>