Ubuntu does not enable the root user account - or even assign a root password - by default. On installation, you are prompted for a regular user account only. The root account is inactive and can’t be used until a password is set for it.
The Unix sudo command is used to turn the regular user into the root user (an abbreviation for "substitute user do" - as in, do a command with another user's privileges)..
To set a password for the root user, open a console and type the following:
sudo passwd root
You may be asked to confirm your normal user password. When prompted, provide a secure (i.e. relatively complex) password for the root user.
To 'become' root at any time in the future, simply type the command:
sudo su
To change root's password in future, type:
passwd root
To change from being the root user, back to be a normal user, type:
exit
If you've forgotten which user you curently are, type:
whoami
To disable the root account (careful with doing this in case changes were made as root), type:
sudo passwd -l root
More on Sudo
As seen above, sudo can also be invoked to perform an activity by simply placing the command in front of others. This saves having to change from an ordinary user to the root user first. For instance:
sudo find / -name *.sh
- invokes the root privileges, to search for files ending in .sh in all driectories on the system. Performing this task as a normal user may not be possible, due to insufficient privileges.