Oct 30, 2008

Disable root ssh login

Disabling ssh is one of the major security enhancement. It is just a simple task. What you need to do is edit a file ("removing a #") and restart the service. Here it goes,
First you need to find the following line and remove the comment from the file "/etc/ssh/sshd_config".
#PermitRootLogin no

ie. Just remove the preceding "#"

You can edit it in your favorite editor. But remember you need to be have root access to edit it.

Or simply you can run the following command from terminal
sudo sed -i "s/#PermitRootLogin/PermitRootLogin/g" /etc/ssh/sshd_config

Now, For this to take effect, you need to restart the service:
sudo /etc/init.d/sshd restart