Sunday, December 2, 2012

Allow root to use SSH


Allowing direct root access over ssh is a security risk. However following steps will allow you to login as root over ssh session:

Open sshd_config file:
# vi /etc/ssh/sshd_config

Find out line that read as follows:
PermitRootLogin no

Edit the file and set it as follows (changing "no" for "yes"):
PermitRootLogin yes

Find out line that read as follows (this line may not exists in your configuration):
DenyUsers root user2 user3

Set is as follows (removing "root" from the listed users):
DenyUsers user2 user3

Save and close the file. Restart the sshd:
# /etc/init.d/sshd restart

That will do the job and you'll be able to login as root via ssh. Please remember to set up your config as before, if this is a temporary fix because as I said before, this is a risk configuration and it's not recommended at all.