Contact Support : +64 220 256 070


How to reset the SSH port number?

Posted on: October 9, 2014

This lesson will teach you on how to reset the SSH port number and how to reset it back to the default port number from WHM.

The Default port number for SSH is 22, to secure the server, it is always advised to change it to a difficult one such as 1891, 1931 etc.

Here is how you may achieve it.

1) Login to server via SSH.

2) Open the file /etc/ssh/sshd_config

3) Locate the line that specifies the port.

4) As default it will be ’22’, change it to a different number.


5) Save and exit.

6) SSH needed to be restarted, you can do so by executing the command:

/etc/init.d/sshd restart


Now you have successfully reset your SSH port number.

Now imagine a situation that you have forgotten the changed SSH port number and can’t login to the server via SSH. However the WHM is accessible.

Then, you can follow the step below to reset the server port from WHM:

1) Login to WHM.

2) Access the following URL on the same browser.


Change the ‘serverip‘ with the IP address of your server. After the execution the SSH port number will be changed to the default number.



Search Blog