Allow root account to use SSH (openssh)

by Vivek Gite · 4 comments

Q. Previous admin blocked root access to ssh server. How do I allow root account access to ssh server?

A. 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
Set it as follows:
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:
DenyUsers user2 user3

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

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 4 comments… read them below or add one }

1 Mika 04.13.07 at 7:04 pm

Your command for sshd is incorrect – should be:
# /etc/init.d/sshd restart

You were missing the “d” for sshd

2 nixcraft 04.14.07 at 8:59 pm

Mika,

It can be ssh or sshd – it depends upon your Linux distro. Redhat/CentOS/FC use sshd and ssh used by Debian or Ubuntu and so on..

HTH

3 Paul 02.27.09 at 9:27 pm

Most people would be wanting to know how to enable this, to secure their boxes. Perhaps the unknown asker doesn’t know how to use sudo or su properly so that you can log in remotely via a safe, unprivileged user account and then, once the connection is secure, issue privileged commands or switch to a privileged account? Or perhaps s/he wishes to have unrestricted access to the computer with no tracking of who issued what commands?

4 Nick Wierdo 10.20.09 at 12:15 am

just do a ” svcadm restart ssh”

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All