Linux – “user is not in the sudoers file” despite user belonging to group wheel

linuxrootsudousers

I've added a new user to the group wheel. I can ssh into the machine with this user and password and confirm that it belongs to that group:

[newuser@xxx.xxx ~]$ groups
newuser wheel

But still, if I try to run anything with root permissions:

[newuser@xxx.xxx ~]$ sudo ls -lt /root
[sudo] password for newuser:
newuser is not in the sudoers file.  This incident will be reported.

And visudo confirms that users in the group wheel should have these permissions:

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

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

All tutorials say that adding a user to this group should be enough. What else do I have to do?

PS: this is a amazon-linux machine

Best Answer

The wheel entry in the sudoers file is commented out, so the group wheel has no sudo access at all.

Remove the # from the line:

%wheel        ALL=(ALL)       ALL
Related Topic