DEV Community

Stack All Flow
Stack All Flow

Posted on • Originally published at stackallflow.com on

How to Enable Root Login in Ubuntu?

Ubuntu – How to enable root login

rootusers

I would like to enable the root account on my Ubuntu installation.

I realize the security implications of this.

Accepted Answer

Warning

While it’s possible to do, it is not recommended.

Enabling

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.  

Enter fullscreen mode Exit fullscreen mode

So, first execute in a terminal

sudo passwd root

Enter fullscreen mode Exit fullscreen mode

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

Then execute

sudo passwd -u root 

Enter fullscreen mode Exit fullscreen mode

to unlock the account. This should return

passwd: password expiry information changed

Enter fullscreen mode Exit fullscreen mode

Reverting

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

Graphical version needs setting up 1st:

pkexec gnome-terminal will open a terminal with a root prompt.

passwd root will allow you to create a password for root.

Note: Running users-admin with elevated privileges no longer works because of a bug that is marked as “Won’t Fix” for security reasons. See https://bugs.launchpad.net/ubuntu/+source/gnome-system-tools/+bug/685215 for an explanation.

pkexec users-admin will open the users screen: im1

Documentation

The post How to Enable Root Login in Ubuntu? appeared first on Stack All Flow.

Top comments (0)