Enable Root user Login in Ubuntu Desktop

Root user/sudo

sudo is a program for Unix-like computer operating systems that enables users to run programs with the security privileges of another user, by default the superuser. It originally stood for “superuser do”, as that was all it did, and it is its most common usage; however, the official Sudo project page lists it as “su do”.

The current Linux manual pages for su define it as “substitute user”, making the correct meaning of sudosubstitute user, do“, because sudo can run a command as other users as well

Unlike the similar command su, users must, by default, supply their own password for authentication, rather than the password of the target user. After authentication, and if the configuration file (typically /etc/sudoers) permits the user access, the system invokes the requested command. The configuration file offers detailed access permissions, including enabling commands only from the invoking terminal; requiring a password per user or group; requiring re-entry of a password every time or never requiring a password at all for a particular command line. It can also be configured to permit passing arguments or multiple commands

If you want to grant sudo access to another user, simply add the user to the sudo group:

usermod -aG sudo username

To temporarily elevate root user privileges, run the command prefixed with sudo:

sudo some-command

The first time you use sudo in a session, you will be prompted to enter the user password.

If you want to run a command with sudo privileges without entering the password, you’ll need to edit the sudoers file. To do so type visudo:

sudo visudo

This will open the /etc/sudoers file with your favorite command line text editor . Add the following line by replacing username with your username:


Enable Root User Account in Ubuntu

If for some reason, you need to enable the root account, you just need to set a password for the root user . In Ubuntu and other Linux distributions, you can set or change the password of a user account with the passwd command.

As a regular user in Ubuntu, you can only change your own password. The user you are logged in as must have sudo privileges to be able to set the root password.

To enable root account in Ubuntu, run the following command: –

sudo passwd root

You will be prompted to enter and confirm the new root password:

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

The password is not shown on the screen when you type it.

That’s it! You have successfully enabled the root account. You can now log in to your Ubuntu machine as user root using the new password.

Disable Root User Account in Ubuntu

If you previously enabled the root user in Ubuntu and now you want to disable it, set the root password to expire.

To disable the root account password, use the following command:

sudo passwd -l root


To enable the root user account in Ubuntu, all you need to do is to set the root password.

When setting the password, make sure you’re using a strong and unique password. Having a strong password is the most important aspect of the security of your account. Often a strong password has at least 16 characters, at least one uppercase letter, one lowercase letter, one number, and one special character.

If you have any questions or feedback, feel free to leave a comment.

Leave a Comment

%d bloggers like this: