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.
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
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
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
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:
- How to Install Red Hat Linux 7.3 on Virtual Machine
- Fixing PuTTY connection issue while connecting to Red Hat Linux Server
- Installing SQL Server 2017 on Red Hat Linux Server
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.
- How to Fix SQL Error 1005: A Comprehensive Guide - April 9, 2023
- How to Fix SQL Server Error 207 – Invalid Column Name - April 9, 2023
- How to Fix SQL Error 1045: Resolving Access Denied Issues - April 8, 2023
I couldn’t even connect to superuser account.. What is the password?