LINUX: (user) is not in the sudoers file

Alexandre Rosseto
1 min readSep 12, 2020

In Unix/Linux systems, the root user account can be used to do anything and everything achievable on the system. However, this can be very dangerous because the root user might enter a wrong command and breaks the whole system or an attacker gets access to root user account and takes control of the whole system.

In some Linux distributions, the root user account is locked by default, regular users (system administrators or not) can only gain super user privileges by using the sudo command.

How to Fix the Problem

First, change to root user.

$ sudo su

Now, let’s edit sudoers using nano editor.

nano /etc/sudoers

Try to find the section where this text is in place.

# User privilege specification
root ALL=(ALL:ALL) ALL

Insert the missing user right below of the text above as shown below.

<your user>   ALL=(ALL:ALL) ALL

After edit it, press CTRL + O simultaneously and press ENTER to confirm the changes. Next, press CTRL + X to exit nano editor. You can leave root user using the following command:exit.

Now you can run any program via terminal.

--

--

Alexandre Rosseto

Senior Tech Manager specialized in Java with experience in software factories and consultancies. LinkedIn: https://www.linkedin.com/in/alexandrerosseto