Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to collect information on what sudoers actions a user can perform on a server. From what I've read, you can do this with the command sudo -l -U username. However, one server that I have has a slightly older version of sudo (1.6.7p5) and the -U option doesn't seem to exist (I don't own the server so I can't just upgrade to a newer version of sudo).

Has anyone ever had to collect sudoers information for all users on a server? How would you recommend doing it?

EDIT: This has to be an automated process, so "just look at the sudoers file" won't work.

share|improve this question
    
If you at least have root privileges, you can install a newer sudo to your home directory (./configure --prefix ~/usr or your location of choice), run it with -U, then simply remove it. –  grawity Jan 11 '11 at 14:16
    
I don't have root privileges or permission to install a newer sudo. –  Jon Kruger Jan 11 '11 at 15:30

2 Answers 2

You can just do visudo and see what options each user has.

share|improve this answer
    
This has to be an automated process, so just visually looking at the file won't work. –  Jon Kruger Jan 11 '11 at 15:29

As root:

cat /etc/sudoers > /home/username/sudoerprivs  
cd /home/username  
chown username:username sudoerprivs
share|improve this answer
    
This has to be an automated process, so just visually looking at the file won't work. –  Jon Kruger Jan 11 '11 at 18:25
    
Can't you just search through the file with grep and awk based on the lines you need? –  Diablomarcus Jan 20 '11 at 23:07
1  
@Diablomarcus - yes you could. I made a copy in this method so it could be moved to another computer in an enterprise environment. Then you could launch shell scripts containing grep or awk at a hierarchy of directories/files to programmatically check ALL computers. –  hbdgaf Jan 21 '11 at 1:11

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.