How To Allow SSH Root Login On Ubuntu 20.04

In this article you will learn How to Allow SSH Root Login on Ubuntu 20.04 LTS Linux step by step.

By default you can login as other user. SSH login as root disabled on Ubuntu for security reasons. Also By default the root doesn’t have password set on Ubuntu 20.04 Linux and you will get an error: access denied.

ubuntu 20.04 ssh root access denied

But root SSH login can be enabled by editing OpenSSH daemon (sshd) configuration.

WARNING! Using SSH root login is a bad idea!

Allow SSH Root Login on Ubuntu

Step 1

Login with privileged user account (or sudo su) into your Ubuntu server and open with any text editor (nano, vi, vim) sshd config file /etc/ssh/sshd_config

$ vim /etc/ssh/sshd_config

Step 2

Find commented PermitRootLogin parameter or manually add

PermitRootLogin yes

As shown on image:

Allow SSH Root Login on Ubuntu

Step 3

After finish editing configuration file save and close it.

For the changes to take effect, you must restart sshd daemon.

Run:

$ sudo systemctl restart ssh

Step 4

Now we need set password for the root with using passwd command:

$ sudo passwd root

Example output:

$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully

Now you will be able SSH login as root to your Ubuntu server

$ ssh [email protected]

Conclusion

Enable SSH Root Login on Ubuntu

To enable Root Login on Ubuntu edit sshd daemon configuration PermitRootLogin parameter to:

1. PermitRootLogin yes
2. Save changes
3. Restart sshd daemon
4. Set password for the root with using passwd command

Discuss article in ArsTech Forum

Read also: How To Setup SSH: Public Key Authentication On Linux

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Leave a Reply

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