How To Login As Root In Ubuntu?

1 week ago | Carolina Jacobi

How To Login As Root In Ubuntu?

Just like the Administrator in Windows 10, in Linux, there is always an admin user named Root. The concept is the same as Administrator; Root can make any changes to the system, accessing all files, running commands, changing security settings, etc.. It gives you complete access over the system; hence it requires utmost caution. One incorrect command can destroy many files of the system. It is to avoid these accidents in the first place; the Root user is locked in Ubuntu.

Normal daily tasks and applications do not require a Root user, like, downloading and uploading from the internet, creating and deleting documents, etc. . So enable the Root user only if some task gets restricted; it is not suggested otherwise.

Why would you need a root user in Ubuntu?

Some system-specific tasks do need privileges provided by the Root user. Suppose you need to update Ubuntu via the command line; this command does not run as a normal user. The permission will be denied for it.

What is Sudo or Sudo commands?

Now, do you know how to run commands as Root? We can run commands as Root by adding sudo before commands. Ubuntu, Ubuntu distributions, and Linux distributions use a mechanism for it that is called Sudo. Sudo is a program that manages access to the commands that are being run as Sudo or normal users. Sudo is a dynamic and versatile tool. This is the program that allows a user to run all commands as Root by configuration. This configuration can be selective to allow only a set of commands as root or make it so the sudo can run without any password.

As you know when you install Ubuntu you are asked to create a user account that works as admin on your system, as per the sudo policy. The default policy in Ubuntu can run any command on the system with root privileges. Sudo does not even require a Root password, and it works on the user’s own password. Whenever you run the command with sudo it will ask for the user's password. If you run the Su command and do not enter the password, you will come across ‘su authentication failure’.

Going back is simple; like any other command, you can go back to the normal user by using the exit command. 

How to Login As Root in Ubuntu

When you first log in to Ubuntu on your PC, it does not enable the Root automatically. It does not even ask for Root user credentials. It will create a normal user, and this normal account will have sudo privileges. This user will be used to run sudo commands to perform administrative tasks required. 

To enable the Ubuntu root account, you will need to give it a password. To give a password use passwd command. To run the passwd command on the root account, you will need privileges of sudo.

Now, how to do that? There are a few steps to do that. 

First, open the Ubuntu terminal and run the groups by the command “groups”. It will tell you if you have the root privileges or not; if you have them, then set the root password with the following command: “sudo passwd root”. The first command prompts your password to confirm the privileges and the passwd command prompts you, to enter a new password, you have to enter the password two times.

Now it is ready to log in as a root user, you can log in by using the su command by typing: su-. After that enter your password, and you are in as a root user.

How to login as root in Ubuntu desktop Graphic User Interface (GUI)

Now, if you want to login as root to the Ubuntu, there are a set of instructions more to follow and enable the root user:

First, open the required path – “/etc/gdm3/custom.conf” and now add AllowRoot that is true under the [security] block, in the following pattern: 



The next step is to open the path – “/etc/pam.d/gdm-password” , that try to locate the line given below:

auth required user != root quiet_success

add it as a comment by putting # in front of the line:

#auth required user != root quiet_success

Now you can restart your computer; when you come back and go to the login screen, click on the “not listed?”.

The last step is to enter the root user name and password, and you are in.

What do if an error comes when loading root?

If you get an error while loading root, follow a few commands and open the root profile in a text editor to rectify it. 

In the text editor type - gedit /root/.profile

Then find the line mentioned below:

mesg n || true

When you find it delete and replace this line with the following command.

if `tty -s`; then

  mesg n


Repeat the log-in process, as stated above.



The way that visitors or employees are treated in a business setting can decide the fate of an agreement.…
We're continuously looking for methods to improve conversion rates and encourage consumers to participate…
Tiktok is a platform that allows users to make and share their own interactive stories. The storytellers…
The design of your login page is an important aspect of your website's user experience journey. Good…
Google has issued a warning to delete nine apps that are stealing your Facebook password. With capabilities…
TikTok is a video-sharing and making application recently known as Individuals of each age…