How to fix “<some user> is not in the sudoers file. This incident will be reported” in Ubuntu

You mind your own business all of a sudden, you need to use the sudo command to change something on your Ubuntu Linux system. And you realize that your user does not have permission to run commands as a root. What do you do?

Valentin Despa
DevOps with Valentine

--

What is the problem?

Let’s replicate the error. First, I will use sudo on a command, like the one below:

sudo whoami

After being prompted to enter the user password, the following error appears:

<some user> is not in the sudoers file.  This incident will be reported.

First of all, you don’t need to worry. Law enforcement is not on to you because you are not root. No idea where this incident was reported, probably it is in one of the system logs. Anyway, you are getting this error because your username is not in the sudo group.

Next, I am making the assumption that you have full control over the machine in question. If you are not the one managing this machine, it is best to ask a system admin for help.

One possible solution

--

--

Valentin Despa
DevOps with Valentine

Software developer, educator & overlander • GitLab Hero • AWS Community Builder • Postman Supernova • Imprint: http://vdespa.com/imprint