Enable Root Login via SSH In Ubuntu

Posted on by Alison Gray | Updated:
Reading Time: 2 minutes

By default, SSH on Ubuntu comes configured in a way that disables the root users log in. This was originally enabled as a security precaution which means that you cannot directly log in as the root user over SSH. However, you can usually get around the need for root ssh login by using the sudo command. In some cases, though it’s just more convenient to get directly logged in as root.


Enable Root Login via SSH In Ubuntu

Enable root login over SSH

  1. Login to your server as root.
  2. As the root user, edit the sshd_config file found in /etc/ssh/sshd_config:vim /etc/ssh/sshd_config(For details on working with Vim check out our article here!)
  3. Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there.
    PermitRootLogin yes
  4. Save and exit the file.
  5. Restart the SSH server:
    systemctl restart sshd
    or
    service sshd restart

And that’s it! With the new line added and the SSH server restarted, you can now connect via the root user.

In this instance, you are going to be able to login as the root user utilizing either the password or an ssh key.

When using SSH Keys, you can set the PermitRootLogin value to `without-password` instead of yes. To accomplish this, simply modify the following information noted in step 2 above instead:

PermitRootLogin without-password

This process should work on almost any version of Linux server that the sshd service is installed. If you are using a cPanel server though you can easily control this setting from the WHM interface. In these cases, it’s recommended to modify this setting from your control panel interface.


Have more questions about this process? Reach out to one of our Heroic Support admins 24 hours a day, 365 days a year by creating a ticket at support@liquidweb.com, opening a chat with us or giving us a call at 1-800-580-4985. We are always looking forward to providing an answer to any questions you may have!

Thank you for hosting with Liquid Web!

Avatar for Alison Gray

About the Author: Alison Gray

Alison Gray is currently an IT Project Manager at Liquid Web and has been with Liquid Web for nearly 10 years. In 2015, She earned her Bachelor's Degree in Media and Information from Michigan State University. In her free time, she loves spending time with her girlfriend and 3 kids. You can usually find her at a basketball court or some sort of sporting event. If the weather's right, she loves being outside in the yard finding some sort of yard work to do.

Latest Articles

Managed Server vs. Unmanaged Server Defined

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article