Member-only story

How to Gain Superuser Privileges on Linux

Gaining administrative privileges on Linux via the sudoers file

Mwiza Kumwenda
3 min readApr 9, 2024
Photo by Gabriel Heinzer on Unsplash

The sudoers file is very integral to a Linux system. It contains definitions for the sudoers policy.

Basically, this is where you define the privileges a user on your system should have.

Unlike Ubuntu where the default user is given sudo privileges, on Debian and RHEL regular users are not given sudo privileges. This is for security purposes, to prevent accidental or malicious changes to your system.

Gaining Superuser Privileges

To give a regular user superuser privileges similar to that of the root user you can add the following line to the sudoers file.

The sudoers file is located at /etc/sudoers

username ALL=(ALL:ALL) ALL

See example below where the user mwizak has been granted administrative privileges similar to that of root.

You need to use the sudo keyword before any administrative commands that you want to run. For example, sudo apt update. You’ll be prompted for a…

--

--

Mwiza Kumwenda
Mwiza Kumwenda

No responses yet