I had install centOS 7 minimal version in my virtualbox in Ubuntu mate. It has no GUI. It is totally CLI. My user name is Smit and able to login in to it. But when i type command

sudo yum update

and enter my password, it says

Smit is not in sudoers files. This incident will be reported.

But when I try to add my user to sudo group by command

adduser Smit sudo

gives something like this:

enter image description here

(I am unable to copy-paste via virtual-box. I do this by login in root.)

  • i had used the command in both manner.without <> and with <>
    – user254419
    Commented Jun 10, 2017 at 18:12

3 Answers 3


I don't know why your command doesn't work. It may have to do with either:

  • your CentOS not using sudo by default
  • the way the sudoers file should be edited
  • the syntax of adduser command on that particular machine.

Apparently, and it is my guess, it's first of all a matter of the last point.

Anyhow, the easiest way is to add the user to the wheel group, which should have sudo priviliges on your CentOS. Try out this command:

usermod -aG wheel Smit

This of course has to be done by root. Once successfully executed, change identity to Smit and check if you can sudo.

su - Smit
sudo yum update

As an alternative, you can use visudo. Adding this line should do:


But here's a guide with a few more details if you're interested.


You just need to add user Smit to group wheel which is have permission to run all commands with sudo command And you can accomplish it by entering the following command

vim /etc/group

look for wheel group and add smit to it

enter image description here

save and exit and thats it.


I've run into the exact same situation with OP. Tried the same command and got the same result.

Then I used

usermod -aG sudo Smit

and got the result

The group "sudo" does not exist.

I think that is the reason adduser Smit sudo dose not work -- The group "sudo" does not exist yet!

The following command to add the user to the "wheel" group does work.

usermod -aG wheel Smit

But at this point, switching to user Smit and trying sudo still failed! I have to do one more thing. Use visudo to open and edit the /etc/sudoers file. Make sure that the line that starts with %wheel is not commented. It should look exactly like this:

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

That is the final step to set up set up the account and now everything is OK.

You must log in to answer this question.