Enable direct root login on Ubuntu

By default, direct root login is disabled in Ubuntu. You need to follow below steps to enable it.

Step1: Login to server via sudo user and become root.
testuser@master:~$
testuser@master:~$ sudo su -
[sudo] password for testuser:
root@master:~#
Step2: Open /etc/ssh/sshd_config file using your favourite 
editor and make below changes:
Current Configuration:

root@master:~# cat /etc/ssh/sshd_config | grep -i PermitRoot 
#PermitRootLogin prohibit-password

Changed to:

root@master:~# vi /etc/ssh/sshd_config
PermitRootLogin yes

Save and exit file.
Step3: Restart sshd service.
root@master:~# systemctl restart sshd
Step4: Login and check if you are successful or not.

Leave a Reply

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