Root password in Ubuntu






When installing Ubuntu Linux you’re only asked for a user password and never a root password. It is a security risk to use the root account but sometimes it is necessary. In Ubuntu I have been asked for the root password when doing Upgrades and since the root password isn’t set (not the same as an empty password) I’m not able to do the upgrade. This is how I solved it by creating a root password using sudo as shown in the example.

user@ubuntu:~$ sudo passwd
[sudo] password for user:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
user@ubuntu:~$

Other ways of getting root access are:

Start a shell with sudo

user@ubuntu:~$ sudo sh
[sudo] password for user:
# 

Run su with sudo to get a proper root login

user@ubuntu:~$ sudo su
[sudo] password for user:
root@ubuntu: /home/user#