Allow root account to use SSH (openssh)

by Vivek Gite on November 2, 2006 · 6 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:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 6 comments… read them below or add one }

1 Mika April 13, 2007

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

You were missing the “d” for sshd

Reply

2 nixcraft April 14, 2007

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

Reply

3 Paul February 27, 2009

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?

Reply

4 Nick Wierdo October 20, 2009

just do a ” svcadm restart ssh”

Reply

5 Luis GarcĂ­a July 18, 2011

That only would work on Solaris :-)

Reply

6 Rhea May 12, 2011

Hi,

I wanted to enable root login via ssh in my server, but couldn’t see the below file on the server. Please help.

/etc/ssh/sshd_config

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 10 + 8 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: