e Learning

How to Become Superuser in Linux

On a Linux system Superuser refer to the root user, who has unlimited access to the file system with privilege to run all Linux commands.

Regular Linux user can only access files owned by the user himself. same way regular users cannot execute commands that have an effect to the hole Linux system. So most of the time you will have to become Superuser if you want to perform administrative tasks.

There are two methods we can use to get superuser access in Linux.

Method 1

Becoming root using the su command

Linux su command allows regular users to log in as root using the root password. Just logged in to a regular user account and type following command on the terminal.

su –

You will be prompted to type root password. Once you entered the correct password, you will be redirected to the root shell which has superuser access and maximum privileges to the file Linux system. Type exit, or press CTRL+D on keyboard to logout from the root shell.

Method 2

Becoming Superuser using Linux sudo command

Some Linux distributions like Ubuntu, RHEL 7 and CentOS 7 allows regular users to get superuser access by using their own password by using the sudo command.

sudo -i

This time you will be prompt your own password, not the root password.

Not all users can use the sudo command. In CentOS 7 only the member of the wheel group can execute commands with sudo. In Ubuntu Linux member of the either sudo group or admin group able to run the sudo command.