e Learning

User is not in The Sudoers file – SOLUTION

Question

When I try to execute administrative commands with sudo command as a regular user it returns the following error.

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

How can i Fix this error and run commands with sudo. Our Server is Running Linux CentOS 7.

Answer

This is Because your user does not have sudo privileges. In CentOS there is an administrative group named wheel. Only the Members of the wheel group can run sudo command. To fix the error all you have to do is , add non root user to the wheel group. For that we can use Linux usermod command.

usermod -a -G wheel username

For Example In My Linux Server I have a user called sysadmin and if i want to give sysadmin user the sudo privileges, Type.

usermod -a -G wheel sysadmin

Now sysadmin user can run Linux Commands as administrator with sudo in front.