Enable Root Login via SSH in Ubuntu 20.04

Enable Root Login via SSH in Ubuntu 20.04

In this tutorial, we talk about Enable 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.

stay with us.


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.

Point: For Enable Root Login via SSH in Ubuntu 20.04, you need Sudo username or local login with root user.


Login to Ubuntu 20.04

Login to your server as root.


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 we 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

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.

4- Restart SSH service for loading new configuration on SSH_config file.

sudo systemctl restart sshd.

Now you can check SSH via Root user.

Attention: The root user is powerfully user and if your VPS hacked by any hacker and access root user, your server gone forever. So e suggest you read the initial server setup on Ubuntu 20.04 and make another sudo user for any changes and installation.



In this article, we talk about Enable Root Login via SSH in Ubuntu Focal Fossa and After reading the article, you can log in to Ubuntu 20.04 via ssh with root user.

I hope to read a useful article on the Eldernode blog.


Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these