How to change SSH port number

How to change SSH port number

If you want to change your ssh port number other then 22 you can do it by editing sshd_config.

Step 1 : Login to your server as Root

Step 2 : edit it nano /etc/ssh/sshd_config

Step 3 : Search for following line that has :

Port 22

Step 4 : Change the port number as you want.

Note : Make sure port is not being use by another service.

Step 5 : Save the file

Step 6 : Restart sshd using the following command : /etc/init.d/sshd restart

Step 7 : open the same port on firewall  as you changed in config file /etc/ssh/sshd_config .

Leave a Comment