Ubuntu - Enable root account

Page 1 / 1

Under Ubuntu, the root account is disabled by default. Instead you must use the "sudo" command to perform the required operations with the root account. However, if you want to enable the root account, you can just define it a password.
Type the command :

Code : Bash

sudo passwd root

Then type your password (because of sudo) and 2 times the new password for the root account.

Code : Bash

[sudo] password for informatiweb:
Enter the new UNIX password :
Retype new UNIX password :

You can then log in as root by typing the following command and using the password of the root (not the one you specified with sudo) account :

Code : Bash

su -

If ultimately you want to re-disable the root account, you can simply use the parameter "l" of "passwd" command.
Since the password has expired, the account will be disabled.

Code : Bash

sudo passwd -l root