Sunday, April 11, 2010

Enable or Disable Direct Root Login in Linux







Enable or Disable Direct Root Login

Many data centers disable direct root login to servers for security reason. You need to login first as a normal user than su to login as root.
But i like direct login as root. So i disabled this extra security on my servers. If some one can get my root password, they can also get my normal users password. So what i do is use complicated root password and keep it secure.
To enable or disable root login, you need to set this in /etc/ssh/sshd_config file.
# cd /etc/ssh
# vi sshd_config
To disable direct root SSH login, you need to add following to /etc/ssh/sshd_config
PermitRootLogin no
To enable direct root SSH login, you need to add following to /etc/ssh/sshd_config
PermitRootLogin yes
After you do the changes, save and exit. Then restart sshd.
On FreeBSD
# /etc/rc.d/sshd restart
On Linux
# /etc/init.d/sshd restart
Now you will be able to login to SSH directly as root. I use RSA key for authentication, so just double click on the server entry will get me login, no passwords to remember. Only thing is i have to keep my Private Key secure.

No comments:

Post a Comment