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.
Table of Contents
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
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.
The /etc/lightdm/lightdm.conf file does not exist! what should I do?
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.
What should we do to log in with the root user in the Ubuntu Desktop operating system?
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
Hi, my question is what version of UBUNTU can I install on VMware?
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.
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.
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.
How to enable a root password?
ehowstuff@ubuntu16:~$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Is it necessary to enable the root user on Ubuntu Linux?
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.
Is Root User Access to ssh enabled by default on the Ubuntu Linux distribution?
No; In the Ubuntu Linux distribution, by default Root user access to ssh is disabled and direct login is not possible.
How to enable ssh root login on Debian?
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
How to enable ssh access on Ubuntu?
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.
Will there be a problem if the server has a firewall?
If your server has a firewall, you need to make sure the SSH port is open for it. The SSH port is 22.
I found PermitRootLogin without-password but how do I edit this to PermitRootLogin yes in the command prompt?
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”.
Thank you very much
Thanks for your comment