How to Enable the root login in Ubuntu

By default, Ubuntu disables the root account. Since root is godmode, disabling it means that all of the hackers with automated scripts that try to break the root account are wasting their time.

While it’s possible to enable the root login in Ubuntu, it is not recommended.

To Enable the root login

To actually enable root logins first you have to set a password for the root account and then unlock the locked root account. If you don’t set a password for the root account the passwd command will return

passwd: unlocking the password would result in a passwordless account.

So, first execute in a terminal

sudo passwd root

you will be prompted for a new Unix password. Write it twice (second for confirmation).

Then execute

sudo passwd -u root

to unlock the account. This should return

passwd: password expiry information changed

To Revert Back (Disable the root login)

If you want to disable root account in Ubuntu you need to lock the root account by using the following command

sudo passwd -l root

Alternatives to root login

If you want to work on a root console you can also use

sudo -i


Only do this if you know what you are doing. More information on why to stay with sudo here.


Leave a Reply

Be the First to Comment!

Notify of