1

I am running CentOS 7 web server in a VM on our network, and it all looks like I am in the sudoer list but when I try anything with I get the following error:

$ sudo ls
[sudo] password for dragonbite:
dragonbite is not in the sudoers file.  This incident will be reported.

I looked in /etc/group and verified I am in the wheel group

wheel:x:10:dragonbite

I ran visudo and verified the wheel group is listed

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

So it seems to me that everything is as it should be. I even tried adding the account from the first user by running

sudo usermod -aG sudo dragonbite

and got the message, after putting in that account's password

usermod: group 'sudo' does not exist

strange,... since it uses the wheel account as far as I know (CentOS). So I tried adding a sudo group with

sudo groupadd sudo

and then when I tried to add my account to the sudo group it didn't throw any errors. But the group sudo isn't in the sudoers file, and after adding myself to the sudo group I tested it and still get the same message of not being in the sudoers file.

So I am at a loss of what to do next.

  • Add sudo to the sudoers list?
  • Try making a new account and add it to sudo list?
  • Restart the server (do not want to do)?
  • Revert to latest VM and re-apply all the patches?

Anybody?

Thanks

  • 2
    Did you log off and log on again after adding the relevant user to the wheel group? What is the output of the id command? – Wouter Verhelst Apr 3 '18 at 14:12
  • I did log off and on and tried after changing things, and just logged back in after being off maybe 5 minutes and it still doesn't work. Running id command from the account I am trying to fix gives me $ id uid=1001(dragonbite) gid=1001(dragonbite) groups=1001(dragonbite),13(sudo) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 – dragonbite Apr 3 '18 at 14:23
  • 1
    Well, for whatever reason you're not in the wheel group. – roaima Apr 3 '18 at 15:05
  • It's gotten worse. Now the account that WAS able to run sudo previously, when I typed up the initial piece, is no longer in the sudo/wheel group either! So now i have no admin rights left. I think we need to see about reverting the snapshot but does any of this sound like a process or something from a compromised system or attack? – dragonbite Apr 3 '18 at 15:19
  • @dragonbite Did you make changes to the sudoers file or do the group membership of the other user? Does the sudoers file mention a sudo group? – Kusalananda Apr 3 '18 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.