Say I am part of various groups

$ groups
users git engineering ....

And I can execute sudo in that machine, How can I tell which group is responsible for my sudo execution ability ?

  • It doesn't have to be a group; it could be assigned to your id – Jeff Schaller Jan 28 '17 at 1:15
  • Thanks for the insight. For this case I am certain that sudo ability it is not tied to the user itself but gained with a group association. – Hakan Baba Jan 30 '17 at 17:56


sudo less /etc/sudoers  

or even just

sudo cat /etc/sudoers

and look for something like the following:

%wheel ALL=(ALL) ALL

where the key to your question is the group name following the "%".

See man sudo.conf for an excellent explanation of who gets what privileges based on the line "%" line above and other parameters available in /etc/sudoers and /etc/sudoers.d.

  • 1
    Why pass -f /etc/sudoers? Isn't that the default? – Eliah Kagan Jan 28 '17 at 3:10
  • 1
    Well, I learned something new. I use it rarely and always just use the command target format and am then greeted with the usage message saying to use -f sudoers so I do it that way. I was unaware that it defaulted to the correct file and path with visudo alone. I just tried visudo alone and you are right, that is the default. – airhuff Jan 28 '17 at 5:11
  • Given that the OP might not be the system administrator, why not suggest sudo cat /etc/sudoers (or maybe grep or less) to reduce the chance that the user will accidentally change the file. – G-Man Jan 29 '17 at 1:09
  • Thinking about the way it's written @G-Man, I think "might not be" is pretty clearly "_isn't". That's a great point and I think I should amend the answer; one could certainly cause major problems with an inadvertent keystroke, though they would have to intentionally save it. Still, read-only solution is a better answer here. – airhuff Jan 29 '17 at 1:23
  • Thanks @airhuff, with your answer I was able to find the group that enables sudo permissions. – Hakan Baba Jan 30 '17 at 18:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.