×


Become a Root User in Ubuntu 22.04 - Step by step guide ?

Ubuntu 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.

Here at Ibmi Media, we shall look into the different ways in which non-root users can be changed to root users on your Ubuntu system.


How to Become a root user in Ubuntu ?

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. 

Below are the different ways through which non-root users can be changed to root users on your Ubuntu system:

  • Using command sudo –i
  • Using Command sudo –s
  • Using Command sudo su –
  • Using Command su – root
  • Using Command su –


1. Become a root user 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:

$ sudo -i

The password can then be updated using either the "sudo passwd root" or "passwd" command.


2. Become a root user 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


3. Become a root user 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 -


4. Become a root user using 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


5. Become a root user using 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:

$ sudo -

After enabling the account using the above command, the password can be updated using either the "sudo passwd root" or "passwd" command.


[Need help in fixing Ubuntu Linux system issues ? We can help you. ]



Conclusion

This article covers the different ways through which you can become the root user in Ubuntu (Linux). In fact 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.