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.
Become a root user in Ubuntu
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.
$ sudo -i |
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.
$ sudo -s |
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.
$ sudo su - |
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.
$ sudo - root |
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.
$ sudo - |
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.
Conclusion
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.