SSHD Port Change – Linux interview question

 

 

This is most common interview question for freshers.

How do you change sshd port ?

 

Login as root:
cd /etc/ssh
pico -w sshd_config
Now look for the line that says #Port 22
Remove the # and change 22 to the number you want to change to
Someting like this : Port 2342443

Use Control-O to save the file
Control-X to exit the pico editor.

The above change tells sshd to listen on port 2342443 for connections.

Now restart service sshd restart

/etc/init.d/sshd restart

Don’t forget to change the port forwarding in your router to reflect the new port that needs to be forwarded to your node computer. If you don’t, you won’t make it in when you try to remotely administer your node