Wednesday, October 8

Disable direct SSH root Login in Linux

For security reasons, if you would like to disable direct root login, here is the way.
It is good idea to login as ordinary  user, and then switch to root using the 'su -' command or use SUDO privileges.

This exercise was performed on Linux SuSE 11 SP2 VM.

Note: It’s a good idea to open two session to perform this activity.

Edit /etc/sshd_config file

$ vi /etc/ssh/sshd_config

# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes

Restart the SSHD daemons

$ /etc/init.d/sshd restart
Shutting down SSH daemon                                            done
Starting SSH daemon                                                 done
$

Done..

If you want to revert back, just comment out “PermitRootLogin” with “#” and restart the daemons.