How to Secure SSH

From Lunarpages Web Hosting Wiki

Revision as of 20:42, 21 August 2008 by Lunarwiki (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Want to read this in another language?

Lunarpages Deal: Save $72 on your next Business web hosting plan! Starting at $18.95 per month, this an offer you can't miss. Perfect for business and e-commerce hosting sites, comes with free e-commerce tools and a TremenDesk Help Desk. Limited time offer!