Ubuntu Linux distribution, by default, disables the root account. To run a command with root privileges, sudo has to be used before the command.
During the Ubuntu installation, you will never be asked to enter the root password. If you view the /etc/shadow file, you will notice that the encrypted password (2nd) field for root is usually marked with ‘!’, meaning that it is inactive.
1 2 3 |
ibrahim@anfield:~$ sudo cat /etc/shadow | grep '^root' [sudo] password for ibrahim: root:!:14239:0:99999:7::: |
If you want to enable the root account, enter the following:
1 2 3 4 5 |
ibrahim@anfield:~$ sudo passwd [sudo] password for ibrahim: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
You should now be able to login using the root account.
If you want to disable the root account, lock the root account by using the following command:
1 2 3 |
ibrahim@anfield:~$ sudo passwd -l root [sudo] password for ibrahim: Password changed. |