Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I list all sudo users at CentOS server?

There are many groups(root, wheel, adm etc) at server, and have users in it. I am looking an easy way/command to find users in all groups who have sudo access.

Note: My user also have sudo access. And I am using 64-bit CentOS release 5.2 (Final).

share|improve this question
    
Why down vote? Is there anything wrong with question? –  Ahsan Jun 3 '13 at 10:55
1  
What have you tried and why didn't it work? It's probably worth noting that "sudo users" isn't all that accurate as the /etc/sudoers file can allow certain users or groups to run specific commands as root or some other user but not all commands as all users. –  Ladadadada Jun 3 '13 at 11:16

2 Answers 2

up vote 2 down vote accepted

Try this:

for USER in `cut -d: -f1 /etc/passwd`
do
  sudo -U $USER -l
done
share|improve this answer
    
Error: sudo: illegal option -U'` –  Ahsan Jun 3 '13 at 11:32
    
Unfortunately I didn't try this on CentOS, only on Ubuntu. What version of CentOS are you using? –  Ladadadada Jun 3 '13 at 11:37
    
64-bit CentOS release 5.2 (Final). All commands I found over internet are for Ubuntu or other. Those are not working on my CentOS server. –  Ahsan Jun 3 '13 at 11:40
1  
It's not a Debian/Ubuntu specific addition. It's in the source. You may have better luck with a more recent version of CentOS. –  Ladadadada Jun 3 '13 at 11:51
    
No way on CentOS 5.2 ? –  Ahsan Jun 3 '13 at 11:58

What is wrong with sudo cat /etc/sudoers and maybe getent group <groupname> to get usernames of group members?

share|improve this answer
    
sudo cat /etc/sudoers shows the groups, i didnt find any users in it and also tried your commnad. I am looking easy way/command which list all users who have sudo rights? –  Ahsan Jun 3 '13 at 11:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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