Enable Root login with openssh


If you come across a situation where you are unable to login as root to your Linux Cloud Server through a standard ssh connection, but you can login with the console in the Control Panel, a likely cause is that remote login as the user: root has been disabled. Control of the PermitRootLogin function is managed in your /etc/ssh/sshd_config openssh config file. 

You may have done this inadvertently or by following someone else's instructions, as this is a common security precaution. To remedy this issue, you will have to connect to your Cloud Server through a console session as the user: root and follow the steps below:

 

Open the openssh config file:

vi /etc/ssh/sshd_config

 

Find the line that reads as follows:

PermitRootLogin no

 

Edit this by pressing i on the keyboard to get to insert mode and changing the line to:

PermitRootLogin yes

Next, save and close the file by:

pressing esc and hitting the colon : then typing x and hitting enter.

 

 

Find the line that reads as follows:

DenyUsers root user2 user3

(It's possible this line may not exist, or that it will have actual user names in it)

 

Edit this by pressing i on the keyboard to get to insert mode and changing the line to:

DenyUsers user2 user3

Save the edit and exit insert mode by pressing esc and esc.

Next, save and close the file by:

pressing esc and hitting the colon : then typing x and hitting enter.

 

Restart the the SSH service:

(Red Hat, CentOS, Fedora, and openSUSE systems):

/etc/init.d/sshd restart

(Ubuntu and Debian based systems):

/etc/init.d/ssh restart

 

If in fact the issue you were experiencing was that PermitRootLogin was disabled, you should now be able to establish a remote ssh connection. 



Was this content helpful?




© 2014 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER