By default, the root user is locked in Ubuntu. To unlock it, simply run the command below, and provide the new password for the root user when prompted.
sudo passwd root
[sudo] password for nik:
Enter new UNIX password:
Retype new UNIX password:
Now you should be able to log in as the root user using the su
command:
$ su -
If for some reason you want to lock the root user password after it has been unlocked you can use:
$ sudo passwd -l root