Fixing Error “User is not in the sudoers file. This incident will be reported.”

I got this error during one of the activity when i was not able to perform it because my user was not part of sudoers file.  The error details were given as “User is not in the sudoers file. This incident will be reported.” If a user is not part of sudoers file then that user cannot perform anything using sudo command. Here i will explain how to fix this error or in other words you can say how to add a Linux user into sudoers file.

Linux Error: User is not in the sudoers file. This incident will be reported.

Sudoers file determines which users can run administrative tasks, those requiring superuser privileges. I was failed to perform certain tasks because my username was not part of this file and returned with below error.

Linux Error: User is not in the sudoers file. This incident will be reported.

user name not in sudoers file

Someone who has super user (su) access can fix this issue by adding the impacted user to the Wheel group. The wheel group is a special user group used on Linux systems to control access to the sudo command, which allows a user to behave as super user. Once we will add our user into this group, we will be able to use sudo command.

Adding a Linux User to Sudoers File

Connect to your Linux server using superuser account.

#Connect using su
su

login using su account

We have now connected to Linux server using superuser account. Now we can add our username to the Wheel group.

#Add your user to the Wheel group. 
#Change techyaz to your user name.
usermod -G wheel techyaz

Add Username to wheel group

Now we see that command executed successfully. If you attempt to execute the sudo command now, you might get the same error message unless you completely logout your user and re-login again. Next you can exit from superuser account by typing exit on the prompt.

#Exit su account
exit

Your account or user added to sudoers file now by adding it to wheel group. You can now connect to Linux server from your PuTTY terminal or on the local server and try to run sudo command post completely logout your user and re-login on the server.

#Connect to Linux server using your user name that was added to wheel group.
#Run sudo su
sudo su

validate the change

You can see we have access to run anything using sudo command in above screenshot. Now your username is part of sudoers file so you can perform your activities using sudo command now.

Read more:

Here, we have fixed Linux error “User is not in the sudoers file. This incident will be reported.” I hope you like this article. Please follow us on our facebook page and on Twitter handle to get latest updates.

Manvendra Deo Singh
Follow me:

You may also like...

1 Response

  1. Sven says:

    I couldn’t even connect to superuser account.. What is the password?

Leave a Reply

Your email address will not be published. Required fields are marked *