Enable Root Login via SSH in Ubuntu 20.04

Enable Root Login via SSH in Ubuntu 20.04

In this tutorial, You will learn enabling root login via SSH in Ubuntu 20.04. And we will show you how to set a password for the Root user and how to enable it. Since the Secure shell helps you to handle your network service when you may face an unsecure network, it is a logical reason to learn about it. Stay with us to verify this secure connection of client and a server. But if you have not get your own VPS, contact us to be a virtual private server owner. You can visit the packages available in Eldernode if you wish to purchase an Linux VPS server.



To let this tutorial work better, please consider the below Prerequisites:

a non-root user with sudo privileges
To set up, follow our Initial server set up on Ubuntu 20.04 LTS.


Recommended Article: Install Ubuntu 20.04 LTS server on VMware

Enable Root Login via SSH in Ubuntu 20.04

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.



Set Root password

After login to Ubuntu 20.04, Now type following command for reset/set root password.

sudo passwd root

After type the command, maybe Ubuntu 20.04 check your password username. first, you put your username’s password and when you see a prompt for a new password, type a new password for root and confirm that.

you succeed to change the root password, now you need to change some configuration on /etc/ssh/ssh_config for the permit root login.


Configure SSH config to permit root login

Edit /etc/ssh/sshd_config file with following command.

nano /etc/ssh/sshd_config

permit root login display


As you see, the PermitRootLogin is set to No. It means that the root login via SSH has been disabled. So, to enable root login change the No to Yes. Find PermitRootLogin and delete No or without-password and type yes.

For example:

Before change

PermitRootLogin without-password

After edit

PermitRootLogin yes

After edit the SSH config file, press Ctrl + x and press Enter button twice for save and exit.

Restart SSH service for loading new configuration on SSH_config file.

sudo systemctl restart sshd


sudo service sshd restart

Now you can check SSH via Root user.




At this point, you learned how to Enable Root Login via SSH in Ubuntu. From now on you will be able to connect to your system remotely and perform administrative tasks. So, log in to Ubuntu 20.04 via ssh with root user and enjoy it. In case you feel interested in reading more about SSH articles, have a look at Install SSH Server on Linux and allow root user login.


How useful was this post?

Click on a star to rate it!

Average rating 4.4 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

24 thoughts on “Enable Root Login via SSH in Ubuntu 20.04

    1. If the /etc/lightdm/lightdm.conf file does not exist, create this file. To do this, when you enter this path into the editor command, the editor command will create this file by default if it does not exist and open it for you while editing, and if this file exists, Add the end of the file.

    1. As in the server version steps, you must change the root user password. Then open the /etc/lightdm/lightdm.conf file in edit mode:
      nano /etc/lightdm/lightdm.conf
      And make the following changes:
      greeter-session = unity-greeter
      user-session = ubuntu
      greeter-show-manual-login = true

    1. You can install any version you want on vmware, but if you are planning to install a 64-bit operating system on your vmware, your CPU must support hyper-threading. Most new CPUs support this feature.

  1. I installed Linux Ubuntu-16.04.3-desktop- now I cannot connect via ssh, I also give the IP, it will not connect again. Another question is what is the difference between ubuntu-16.04.3-desktop and ubuntu-16.04.3-server system?
    Thank you for answering.

    1. The versions you mentioned have been prepared for the server and the client. If you have installed on a server or need to receive a special service, the Server version is suitable, and if you need to use Ubuntu on a home system or laptop for personal use, the Desktop version will be suitable.

    1. If you do not need to activate the root user on Ubuntu Linux, do not activate it, because one of the methods of hackers to infiltrate the server is to use the Brute Force method to log in to your server using root access.

    1. You must first configure the SSH service. To do this, open the /etc/ssh/sshd_config file and change the following lines:
      Search for the following line:
      PermitRootLogin without-password
      And change as follows:
      PermitRootLogin yes

    1. To enable ssh access on Ubuntu, just run the following command in the terminal to install open ssh:
      sudo apt-get install openssh-server
      Then you can connect to ssh via putty with default port 22 and server username and password.

  2. I found PermitRootLogin without-password but how do I edit this to PermitRootLogin yes in the command prompt?

    1. After pressing the “ctrl+w” keys and searching for “PermitRootLogin”, you can easily go to the end of “without-password” or No by using the right button of the keyboard. Then delete it and type “yes”. Finally, to save and apply changes, press “ctrl+x”, type “y” and press “enter”.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day