Problem Statement: Username is not in the sudoers file. This incident will be reported
I installed the CentOS 7 on my system, and ran below command:
sudo yum install vim
and entered my password, it says
"pkumar is not in sudoers file. This incident will be reported."
When I try to add my user to sudo group by command
adduser pkumar sudo
it doesn't add the user pkumar.
When I used the below command:
usermod -aG sudo pkumar
It did not work and I got the below result:
"The group "sudo" does not exist."
The reason adduser pkumar sudo does not work is "The group "sudo" does not exist yet"
The below command to add the user to the "wheel" group does work:
usermod -aG wheel pkumar
But at this point, switching to user pkumar and doing sudo still fails.
We need to do one more thing. Use vi to open and edit the /etc/sudoers file. Make sure that the line starting with %wheel is not commented. It should look like this:
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
That is the final step to set up the account and now everything should work !!
Pankaj
Comments
Post a Comment