To run administrative tasks on Linux, you must have superuser (root) privileges. Most Linux distributions have a separate superuser account, but Ubuntu this is disabled by default. This prevents accidental errors and protects the system from intrusion. Use the sudo command to run commands that require administrative access.
Steps
Method 1 of 2: Running superuser rights with sudo

Step 1. Press the key combination Ctrl + Alt + T to open a terminal window
Since superuser rights are disabled by default in Ubuntu, you will not be able to use the su command and gain administrative rights like in other Linux distributions. Instead, you first need to run the sudo command.

Step 2. Enter sudo before entering the rest of the command
Adding sudo to the beginning of the command will run it as an administrator.
- Example: sudo /etc/init.d/networking stop will shut down the network and sudo adduser will add a new user to the system. Both of these commands require superuser rights.
- Before sudo can execute the command, you will need to enter your password. Linux stores the password for 15 minutes, so you don't have to type it all the time.

Step 3. Enter gksudo before running the command to open the graphical user interface (GUI) program
For security reasons, Ubuntu does not recommend using the sudo command to run GUI programs. Instead, type gksudo before the command that starts the program.
- Example: Type gksudo gedit / etc / fstab to open the "fstab" file in the GEdit GUI text editor.
- If you are using the KDE Window Manager, enter the kdesudo command instead of gksudo.

Step 4. Simulate the superuser environment
If you are an advanced user and want to open a Linux console with real administrator rights to run specific programs, simulate opening the console with the sudo –i command. This command will grant you superuser rights with an administrative environment variable.
- Enter the sudo passwd root command. This will create a password for root, thereby enabling administrative access. See, don't forget this password.
- Enter sudo -i. Enter your root password when prompted.
- The terminal icon will change from $ to #, indicating that you are now the superuser.

Step 5. Grant sudo access to another user
If you are setting up an account for someone who does not currently have administrative access, add their name to the sudo group. To do this, enter usermod -aG sudo username (replace “username” with the correct username).
Method 2 of 2: Enabling Superuser Rights

Step 1. Press the key combination Ctrl + Alt + T to open a terminal window
For security reasons (and to avoid crashes), the superuser account is disabled by default. To safely run a command as an administrator, use the commands
sudo
or
gksudo
… If you simply must have a separate account with superuser rights (if required by the program used in your company or there will be one person behind this computer), enable superuser rights by entering a few simple commands.
Unlocking superuser rights can harm the system, which is why Ubuntu does not recommend doing this

Step 2. Enter the command sudo passwd root and press ↵ Enter
You will be asked to create a new password for the superuser. See, don't lose this password.

Step 3. Enter your password and then press ↵ Enter

Step 4. Re-enter the password, then press ↵ Enter
The superuser account will now have a password.

Step 5. Enter the su - command and press ↵ Enter
Enter the superuser password to open the console.
To disable the superuser account, enter the sudo passwd -dl root command
Advice
- Try to log in with superuser rights as little as possible. Almost all commands that require superuser rights can be run with sudo or gksudo.
- You can use the sudo –i command to access the console of another user on the system. To become a "Max" user, enter sudo –i Max and then enter your password (not Maxim's).