Thursday 8 March 2018

How to change the SSH Port in Linux distribution



We can change the default SSH port in Linux distribution as an added security concerns.

To Change the SSH Port in Linux distribution

Connect to server via SSH
Switch to the root user or use sudo
Run the following command:

[root@linuxcnf ~]# vi /etc/ssh/sshd_config

Locate the following line:

# Port 22

Remove # and change 22 to desired port number.

Restart the sshd service by running the following command:

[root@linuxcnf ~]# service sshd restart


Now we can access the server with the defined port number only.

1 comment: