Ubuntu is one of the most used Linux operating system that provides several utilities to help us perform different tasks according to our requirements. It allows us to change the non-root users of our system to root users in multiple ways. It is important to know how to change the non-root user of your computer, as the root user has complete access to all programs, files, and data on a system. In this article, we will discuss the five different ways in which non-root users can be changed to root users on your Ubuntu system. The root user, also known as the superuser, is a user account that has complete access to all commands, files, data, and resources on the machine. You might have concerns about how you can transform your non-root user into the root user in Linux. For security concerns, Ubuntu disables the root user account by default. On a Linux server, all privileged commands must be run as root or superuser. Unlike Windows, Linux only allows superusers and root to execute a limited number of commands. The Sudo command will be used to become a root user in Ubuntu. It is preinstalled in the latest Ubuntu versions. If it’s not installed, you need to install it. A brief summary of the five different ways through which non-root users can be changed to root users on your Ubuntu system is as follows:
- Use command sudo –i
- Use Command sudo –s
- Use Command sudo su –
- Use Command su – root
- Use Command su –
Method 1: Using Command sudo –i
This command will be helpful if you are logged in as a non-root user in Ubuntu. If the current non-root user does not have sudo access, it will prompt for the password, as shown in the output below. However, if the current user does have sudo access, it will not prompt for the password. On Ubuntu systems, the root user is disabled by default, so you must first log in as a non-root user and then use the below-mentioned command to log in as root. Run the command mentioned below to enable the account. The password can then be updated using either the “sudo passwd root” or “passwd” command.
Method 2: Using Command sudo –s
Run the below-mentioned command to log in as a root user in Ubuntu. After enabling the account using the below command, the password can be updated using either the “sudo passwd root” or “passwd” command.
Method 3: Using Command sudo su –
The “su” refers to the switch user. Run the command below mentioned so that you can log in as root-user if you are logged in as a non-root user. After enabling the account using sudo su -, the password can be updated using either the “sudo passwd root” or “passwd” command.
Method 4: Use Command su – root
Run the command mentioned below to convert a non-root user to the root user. After enabling the account using this command, the password can be updated using either the “sudo passwd root” or “passwd” command.
Method 5: Use Command su –
Run the command mentioned below if you don’t provide the root user with the su command and merely use the su command, it will switch to root user or superuser by default. After enabling the account using the below command, the password can be updated using either the “sudo passwd root” or “passwd” command. By using all these commands, the root users are enabled, logged in and their passwords are being updated successfully. The users can then sign into the root account using a newly updated password.
In this article, a basic overview of root users is provided. The 5 ways through which you can become the root user in Ubuntu (Linux) are being discussed in this article as well. Root users don’t have any default passwords. For this purpose, separate commands will be needed to update its password. As a result, we can conclude that the main reason the root user’s account is disabled by default is that you must enter the root password before logging in to Ubuntu. Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites. The root user in GNU/Linux is the user which has
administrative access to your system. Normal users do not have
this access for security reasons. However, Kubuntu does not
include the root user. Instead, administrative access is given
to individual users, who may use the «sudo» application to
perform administrative tasks. The first user account you
created on your system during installation will, by default,
have access to sudo. You can restrict and enable sudo access
to users with the Users and Groups
application (see “Users and Groups” for more
information). When you run an application that requires root privileges,
sudo will ask you to input your normal user password. This
ensures that rogue applications cannot damage your system, and
serves as a reminder that you are about to perform
administrative actions which require you to be careful! To use sudo when using the command line, simply type «sudo»
before the command you wish to run. Sudo will then prompt you
for your password. Sudo will remember your password for a set amount of time (15
minutes by default). This feature was designed to allow users
to perform multiple administrative tasks without being asked
for a password each time.
Be careful when doing administrative tasks — you might
damage your system! Some other tips for using sudo:
- To use a «root» terminal, type «sudo -i» at the
- The entire group of default graphical configuration
tools in Kubuntu already uses sudo, so you will be
prompted for your password if needed using
kdesu, which is a graphical
frontend to sudo.
- For more information on the
sudo program and the
absence of a root user in Kubuntu, read the sudo page on the
Start a Program Manually with Root Privileges
Sometimes it is necessary to run a program with root
privileges. This is easy to do with the Run
Please be careful while running applications with root
privileges as you may damage your system. See “Root And Sudo” for more details.
- Open the Run Command dialog by typing:
- Enter the name of the program you wish to run,
kdesu and press
Enter. For example, to launch the
file manager Konqueror
with root privileges, type
What is a Root user?
Before starting with how to become a root user in order to perform sensitive Ubuntu operations, it is important to have some understanding of the significance of a root user in Linux. The latest versions of Ubuntu, by default, do not come with a root user with a specially encrypted password; it has hence created a functionality by the name of “sudo” which you can use to perform various administrative operations. You can either temporarily become root user or you need to provide a password with the sudo command that helps in keeping accountability for all actions of the user as an administrator. By default, the first user created when you install Ubuntu is given the sudo rights. Ubuntu gives it complete root privileges and it is added to the list of sudoers in the /etc/sudoers file. It is important to note that you need to be an authorized sudoer to perform all the root user operations described in this article.
About the Article
In this article, we will explain how to become a root user in the Ubuntu command line. This will help you in performing all the software installation, removal, customization, and also system configuration operations. We have run the commands and procedures mentioned in this article on a Ubuntu 20.04 LTS system. We will be using the Ubuntu command line, the Terminal, in order explain how to become and also how to change the password for root user. Therefore, you need to open the Terminal application either through the system Dash or the Ctrl+Alt+T shortcut. Open your Ubuntu Terminal and enter the following command:
$ are -
This command will ask the system to log you in as a superuser. The system will ask you the password for root. Enter the password and hit Enter. Ideally, you now will be able to see the “#” sign in front of your command prompt. This would mean that you are now logged in as root. In case you get the following authentication failure message when you enter the password for root, it means that the root account is blocked at the moment. You can read later in the article about how to lock/unlock the root account. To become root user from an unprivileged (normal user account) account when there is no root password set, use this command:
Enter the password of your Ubuntu user when requested. Only Ubuntu users that are members of the sudo group are able to become root user like this. The user that is created during Ubuntu installation is a member of the sudo group by default. Now that you are logged in as root, you can perform all the administrative operations on Ubuntu. Let us explain this with an example. The file adduser.conf located in /etc/ needs root privileges for you to make any changes to it. When we open it as a normal user, you will be able to see the following lines at the end of the file: “File ‘adduser.conf; is unwritable’
$ nano /etc/adduser.conf
The system file is mentioned as unwritable because an unauthorized user can not make any changes to its configurations. You can only edit it if you are logged in as root or if you are using the sudo command to temporarily avail root privileges. Since we are now logged in as root, we will be able to see the file in the following manner: We can make any changes to the file and save the changes by hitting Ctrl+X. Note: It is very important to stay careful while making any sensitive changes to your system files while logged in as root. Any undue change to the system files can mess up with your entire system settings. You can exit the root command prompt and become a normal user again by using the exit command as follows:
Get Temporary root access through the sudo command
Instead of logging in as a root in the command line and getting on to the # (root user) command prompt, you can use the sudo command with your other commands to temporarily become root. For example, we can open the same adduser.conf file that we mentioned before in an editable format by availing the root rights as follows:
$ sudo nano adduser.conf
This is especially useful because any authorized user(the one added in the sudoers list) can enter their own password and temporarily gain root access for running a few commands. Another benefit of using this command is that you can perform tasks that require root privileges even when the root account is in a blocked state.
Unlock/lock root account
When you get the following message when logging in as root, it is most probably because the root account is locked. Most Ubuntu systems have this account locked by default. You can, however, unlock it by entering the following command as sudo:
$ sudo passwd root
The system will ask you to enter a new UNIX password twice. After that, it will update the root password and the account will be unlocked. After you are done with performing your root operations, you can lock the root account again by entering the following command:
$ sudo passwd -dl root
How to change the root password (An alternative approach)?
Apart from the method we just described above to change the root password, you can use the following alternative method: Only a root user can change his/her own password. Therefore you need to login as root first. Enter the following command to do so:
$ sudo -i
The system will prompt you to enter the current sudo password. Please enter the password and hit Enter. Now that you are logged in as root, you can change the passwd for the current (root) user by using the passwd command as follows:
After working along with this article, you are now capable of becoming root on your Ubuntu command line. You are now free to perform all the operations that only an extremely privileged user is entitled to perform. But be very careful as Uncle Ben would say, With great power comes great responsibility!
- How to cover a gutter hole
- How to address key selection criteria in a cover letter
- How to avoid scams on letgo on android
- How to take an inch off your thighs
- How to prevent ingrown hairs on your bikini line after waxing