Root Privileges in Ubuntu

To be an Ubuntu power user, you must learn the command line. This is the most powerful part of Ubuntu that you can do almost everything from the terminal without the GUI.

In this tutorial we are going to learn how to manage sudo users and how to use ‘su’ command on Ubuntu.

This is a step-by-step tutorial on learn how to manage sudo users and how to use ‘su’ command on Ubuntu. To follow this tutorial, you need to have the following requirements:

• A computer with Ubuntu operating system installed.
• Basic knowledge of Ubuntu terminal. With basic I mean, how to open a terminal on Ubuntu and how to execute commands.
• ‘sudo’ must be available on your Ubuntu system.

First open the terminal of your Ubuntu operating system. You can open your terminal by pressing Control, Alt and T at the same time. You can also go to the Unity dashboard and search by the keyword “Terminal” and click on the terminal. Or you can right click on the Desktop and click on “Open Terminal”.

What is ‘sudo’?

‘sudo’ is used to run command as super user or root. ‘sudo’ grants an ordinary system user the privilege to run any command as root can. Not all user can use ‘sudo’ command. Only users specified on the sudoers file can run commands as root using ‘sudo’.


The sudoers configuration file is used to control which users can run commands as root using ‘sudo’. This file is located under /etc/sudoers.

Open the sudoers file with nano text editor using the following command,

“sudo nano /etc/sudoers”


Here you can see the line “root ALL=(ALL:ALL) ALL” and “%sudo ALL=(ALL:ALL) ALL”

The first line is for users, and the second line is for groups.

Suppose you want user ‘alex’ to have permissions to run commands with sudo. You can do it several ways. You can add a line after “root ALL=(ALL:ALL) ALL” like the following,

“alex ALL=(ALL:ALL) ALL”

Or you can add ‘alex’ to the group ‘sudo’.

The ‘su’ command:

The ‘su’ command is used to switch user account on the terminal. Let’s say you’re logged in as ‘alex’, now you want to be ‘root’. You can do that using the following command,

“su – root”


After executing the command, you will be prompted for the password of root. Type in the password for root, and you will be logged in as root.



You can switch to any user you like, as long as you know the password of that user. But if you’re root, you don’t need password to login to any account with ‘su’.