Linux Commands

How Do I Become a Root User in Linux

The root user appears to be a superuser in Linux, controlled by the system. Superusers are called root in Unix and Linux. The root account has the most access rights within the Linux system, and it is used for administrative purposes. Users are usually called root when they are logged into the root account. However, under Linux and Unix, a root account is a user account with no name and has no user ID. Linux and Unix default to giving root access to files and commands.

How Do I Become a Root User in Linux?

All privileged commands on a Linux server must be executed as root or as superuser. Unlike Windows, Linux doesn’t permit users other than superuser and root to execute many commands. As root users or superusers, we have many options in Linux.

Method 1: Use ‘sudo -i’

If a root user already logged in to the Ubuntu system, that system would block that user by default. This can be accomplished by logging in as a non-root user before logging in as a root user with sudo -i.

The output of sudo prompts the current user for a password if he does not have sudo access. If the user already has sudo access, the system does not ask for a password.

[email protected]:~$ sudo -i

[sudo] password for test:

[email protected]:~#

Method 2: Use ‘sudo -s’

Linux-based cloud instances typically use this method, which requires us to log in as a different user first and then use sudo-s to switch to the root user. Default settings block the root user.

[email protected]:~$ sudo -s


Method 3: Use ‘sudo su -‘

Here su means switch user. If we are logged in as a non-root user, we can log in as root-users using su-command.

As we can see in the output of the above command, if $ appears in the output, it indicates a non-privileged user. Instead of # in the output, it means that our user is a root user.

Method 4: Use ‘su – root’

This method is also another method through which we can switch the non-root user as a root user.

[centos@localhost ~]$ su - root


Last login: Sun Jan 30  21:27:59 EDT 2021 from on pts/0

Method 5: Use ‘su -‘

Suppose we use only su-command instead of specifying root user with su command, then by default. In that case, it will change from current user to superuser and non-root user.

[centos@localhost ~]$ su -


Last login: Sun Jan 30  21:27:59 EDT 2021 from on pts/0


In the above article, we have explained how to use the root user, and we have also explained to you its advantages and disadvantages. We hope you understand and use it better. Our article has multiple ways to become a root user in Linux.

About the author

Ankit Sharma