Super User

A brief description of the super user known as root

Who or what is a super user?

In Linux the super user or administrator account is called root. By default when configuring a system the default user will have the ability to become root.

In the linux terminal the dollar sign $ demonstrates a regular user

Whereas the hash# illustrates the root user

the # also denotes a comment in shell scripting so try not to be confused

How do I become root?

There are multiple ways to become or imitate root.

You can become root by running sudo su - or sudo -i

However, because the root account has not limitations; critical issues can occur from simple typos as such it is preferred to imitate or impersonate root.

The preferred method is to utilize sudo before your commands to run them with root priviliges as needed. Avoid becoming root whenever possible instead do something like:

$ sudo touch files.txt # preferred method
# please avoid doing the below: 
$ sudo su -
# <- root user icon
# touch files.txt
^ the above is an unnecessary use of the root account. 

Why can't I run sudo?

If you're attempting to utilize sudo but are running into an error that says something along the lines of :user is not in the sudoers file this incident will be reported then this indicates that your user is not in the proper group to have sudo permissions. Please note that you may alter the sudoers file utilizing visudo to add your user but that is not advised.

Instead you'll need to become root by typing su - and entering root's password - not your user's password.

Once you have successfully authenticated and become root you'll need to add your user to the proper group:

# To add your user to the proper group become root and run the following:
# For Redhat based distros
usermod -aG wheel $USER

# For Debian based distros
usermod -aG sudo $USER

# where "$USER" is your username. Afterwards type exit to return to $USER

Last updated