Advance

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

OR

sudo service sshd restart

Now you can check SSH via Root user.

 

 

conclusion

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.

 

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

    Will there be a problem if the server has a firewall?

    Reply
    • Dani
      Dani
      8 months ago

      If your server has a firewall, you need to make sure the SSH port is open for it. The SSH port is 22.

      Reply
  • Brian
    Brian
    8 months ago

    How to enable ssh access on Ubuntu?

    Reply
    • Dani
      Dani
      8 months ago

      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.

      Reply
  • Emily
    Emily
    8 months ago

    How to enable ssh root login on Debian?

    Reply
    • Dani
      Dani
      8 months ago

      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

      Reply
  • Joshua
    Joshua
    8 months ago

    Is Root User Access to ssh enabled by default on the Ubuntu Linux distribution?

    Reply
    • Dani
      Dani
      8 months ago

      No; In the Ubuntu Linux distribution, by default Root user access to ssh is disabled and direct login is not possible.

      Reply
  • Edward.sh
    Edward.sh
    8 months ago

    Is it necessary to enable the root user on Ubuntu Linux?

    Reply
    • Dani
      Dani
      8 months ago

      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.

      Reply
  • Carol
    Carol
    8 months ago

    How to enable a root password?

    Reply
    • Dani
      Dani
      8 months ago

      [email protected]:~$ sudo passwd root
      Enter new UNIX password:
      Retype new UNIX password:
      passwd: password updated successfully

      Reply
  • Andrew
    Andrew
    8 months ago

    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.

    Reply
    • Dani
      Dani
      8 months ago

      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.

      Reply
  • Kenneth
    Kenneth
    8 months ago

    Hi, my question is what version of UBUNTU can I install on VMware?

    Reply
    • Dani
      Dani
      8 months ago

      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.

      Reply
  • Steven
    Steven
    8 months ago

    What should we do to log in with the root user in the Ubuntu Desktop operating system?

    Reply
    • Dani
      Dani
      8 months ago

      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:
      [SeatDefaults]
      greeter-session = unity-greeter
      user-session = ubuntu
      greeter-show-manual-login = true

      Reply
  • Ashley
    Ashley
    8 months ago

    The /etc/lightdm/lightdm.conf file does not exist! what should I do?

    Reply
    • Dani
      Dani
      8 months ago

      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.

      Reply

Leave Your Comment

Your email address will not be published.

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

+18054214518

7 days a week, 24 hours a day