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.
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:
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 root@YourServer
Conclusion
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
Start the discussion at forum.arstech.net