Ubuntu Default Root Password or the sudo way

1 minute read

The first time I installed Ubuntu on a computer, I was rather used to debian and went through the whole install process easily.

When I rebooted my system and open a text-console, my first action was to su - in order to gain root’s grants. What a surprise when I was promted for a password. Damn, What was it?!?

Through the installation process, I was asked to enter a username, I entered my usual username, type and confirmed my password, but I was never asked to enter the super-user root’s password!?!

On a usual debian install, you are actually asked for root password and eventually you may want to create a first normal user(which is actually safer).

Ubuntu being a bit more user friendly, thought it was easier for the user to be promted for his password when he wants to do administration actions such as installing software, updating the system… To do this, ubuntu uses the sudo package which allow a user to gain root access for an action. In order to make sure that the user in front of the computer is actually the real user (not somebody using your access), the user is prompted for his password.

In Ubuntu, by default, there is not really a root user, but only root access which can be gained using sudo, for instance, to update your repository list:

sudo apt-get update

Root is created without predefined password, it does not have a password, but it does not have an empty password either, you just can’t login!!!

I actually like to be logged as root when I’ve got many this to do. I find sudo usefull when only one or two actio are to be done, but when doing administration task, typing sudo all the time just drive me cray :).

One way to gain root prompt is to launch a shell as root. Therefore, using sudo you can type:

$ sudo sh

And there you are, you have a root shell.

If you want to be able to login as root, you need to define a password for root:

$ sudo passwd
Enter new UNIX password:
Retype new UNIX password:

Now you can login as root with su.