How to Secure SSH

From Lunarpages Web Hosting Wiki

By default SSH will give root and any local user secure access to the server. For security reasons it is a good idea to change this setting and specify the users which are allowed to have SSH access. The configuration file for SSH is called sshd_config and is either in /etc or /etc/ssh

Login to the server and on the command prompt do:

[root@office root]# vi /etc/ssh/sshd_config

things to change:

#don't allow root to SSH in to the server:
PermitRootLogin no
#users allowed to login:
AllowUsers user1 user2 user3

Now do a "shift zz" (hold down the shift key and tab 2 times the z key) The configuration file now is saved and closed and you have to restart ssh:

[root@office root]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@office root]#

Now you can SSH to your server with your username,then do a su on the command prompt and type in the root password to become root.