Tuesday, 11 April 2017

Securing SSH: How To Change SSH default Port 22

By default OpenSSH is running on Port 22. To make it bit more secure, we should change SSH Server Port. So that client need to mention specific Port while connecting SSH Server.

Let's see How to do this, Need to edit /etc/ssh/sshd_config and SSH Port in same file.
#grep 22 /etc/ssh/sshd_config
#Port 22   # Default SSH Port

#sed -i 's/#Port 22/Port 1234/g' /etc/ssh/sshd_config

#grep 1234 /etc/ssh/sshd_config
Port 1234  #SSH Port after editing

#service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:  

#ssh -p 1234 192.168.2.11
root@qts.infosolution.com's password:
Last login: Wed Feb 10 17:38:25 2016 from 192.168.0.101
root@qts ~#
Now Client need to mention port while connecting SSH Server, This way unknown user can't connect SSH Server


No comments: