How to login as root user on Ubuntu Xenial Xerus 16.04 Linux Desktop

As you may have already notice Ubuntu Xenial Xerus 16.04 Linux Desktop does not come with the ability to login as a root administrator user by default. Every attempt to login as root on a terminal will result in Login incorrect error message:
Ubuntu Xenial Xerus 16.04 root login incorrect.
The reason behind this default Ubuntu Linux desktop behavior is that you rarely need to login as a root user to your GUI desktop. Furthermore, login as root to GUI is highly dangerous and discouraged. The following lines will show you how to gain a root terminal access and how to reset a root password in order to login as root directly.

Using sudo

The recommended way to execute commands as a root user is by using a sudo command. Every time you prefix your command with sudo it will be executed with root privileges. For example the following fdisk -l command with be executed as root. When asked for a password enter your user password:

$ sudo fdisk -l
[sudo] password for linuxconfig: 

Enter into a root shell

If you do not wish to prefix all your commands with a sudo command you may use a sudo command to enter into a root’s shell:

$ sudo -i
[sudo] password for linuxconfig: 
# whoami 

Open GUI window as root

In order to start/open a GUI application as a root user you first might need to disable a client access control:

$ xhost +
access control disabled, clients can connect from any host

Once the client control is disabled enter into a root shell and run your application:

$ xhost +
access control disabled, clients can connect from any host
$ sudo -i
# firefox

Ubuntu Xenial Xerus 16.04 run gui application as root

Start terminal with root privileges

Another way how to gain a root privileges is to directly open a terminal as root. First, press the following key combination:


and enter the below command:

gksu gnome-terminal

Enter your user password when requested.

Login as root

As already mentioned before login as root feature is disabled by default on Ubuntu Xenial Xerus 16.04 Linux. The easiest way to circumvent with this default feature simply reset root’s password using passwd command. First, prefix the passwd command with sudo and enter a new root password:

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

Now use su command to login as root using your new root password:

$ su
# whoami