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

In this article, we will find the solution for error “user is not in the sudoers file. This incident will be reported”.

Error Information:

mike@slave:/home/r2schools$ sudo apt-get update [sudo] password for mike: user is not in the sudoers file. This incident will be reported.

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

Resolution:

I have received above error when tried to update the repository.

1. First solution to avoid this error switch to root(or sudo user) and open the file /etc/sudoer

mike@slave:/home/r2schools$ su Password: root@slave:/home/r2schools# vi /etc/sudoers

Then add following line to the file under “User privilege specification” section.

user_name ALL=(ALL:ALL) ALL

For my case user_name is mike. Then, I am going add below to sudoer file.

mike ALL=(ALL:ALL) ALL

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

2. Second solution is add user to sudo or admin Group by inputting adduser username sudo, put your username in place of username.

Syntax:

adduser username sudo Example:

adduser mike sudo