Published January 16, 2018 by

Change the default SSH port in Linux Server

On Linux server by default SSH run on 22 port. We can change the default SSH port for Linux server as an added security measure.

Before change SSH port makes sure the new SSH port does not conflict with any known, used or blocked ports.

To Chang the SSH port on your Linux server follow the below steps:

1. Connect to server. 

2. Switch the user root using the following command:


# sudo su -

3. Run the following command

# vim /etc/ssh/sshd_config

4. Find the following line

port 22

5. Change 22 to your desired port number. For example:

port 2802

6. Restart ssh services

# service sshd restart