I am trying to give a user sudo privileges in CentoS. When I tried

sudo usermod -aG sudo username

It didn't work saying sudo group doesn't exist. Then I tried

sudo usermod -aG wheel username

it worked but I didn't get the sudo privileges After that, I tried editing the sudoers file and uncommenting the line

%wheel ALL=(ALL)       ALL

But it was already like

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

in it. Still, sudo commands are not working for that user. What should I do now?

  • I did that using visudo only and I have checked i am in the wheel group but still, it's not working – luffy008 Nov 22 at 14:15
  • Yeah I did that. – luffy008 Nov 22 at 14:22
  • and when I am trying to add another user(user3) using the one that I added into to wheel group(user2) it's saying [user2@localhost ~]$ useradd user3 bash: /usr/sbin/useradd: Permission denied – luffy008 Nov 22 at 14:25
  • Okay. So even if a user(ex :- user2) has sudo privileges, it has to use sudo to perform these commands like adduser.Thanks – luffy008 Nov 25 at 8:34

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.