How to enable password and login with default root account in Ubuntu?

The root account is disabled by default which you can enable by setting a password for it. You can use below command to set a password for root.

sudo passwd

Once you can set with new password you can use SU to switch as root and use it. However if you want to login directly using root from SSH you need to do one more step.

sudo nano /etc/ssh/sshd_config

Now look for the variable called PermitRootLogin. Uncomment and change the value to yes.

Restart your SSH service and enjoy login using root.

Updated : 01 Apr 24

Knowledge Bites

Scroll to Top