X

How to: Change SSH Port Number

SSH stands for Secure Shell , It is a virtual terminal used to access linux shell on a network . By default it listens on Port 22 . As the port is world known it is open to Bruteforce and Dictionary attack in which attacker tries number of enumeration to crack the password or private key. Changing the SSH port adds an extra layer of security , in which attacker would be able to attack only if he/she determines the ssh port correctly.

How to :

1. Open sshd_config file residing within /etc/ssh directory

# vi /etc/ssh/sshd_config

2. Check For the entry Port 22 entry in the file and replace 22 with the intended port number , In our example we will use 22754 as port number

 Port 22754

3. Save the file and quit the editor

4. Restart sshd service

# service sshd restart

Or

# /etc/init.d/sshd restart

 

 

  • Tags: change port, change port for ssh, linux ssh, ssh,