Sudoers list?

Chris Bannister cj at moodog.org.uk
Tue Apr 4 20:07:39 UTC 2006


Daniel Carrera wrote:
> Matthew R. Dempsky wrote:
>>> I'm writing a script. How can I find out, from the script, if the 
>>> current user is in the sudoers list?
>>
>> This may be of help, from sudo(1):
>>
>>         -l  The -l (list) option will list out the allowed (and 
>>             forbidden) commands for the user on the current host.
> 
> The problem with that is that you need sudo access to run it. If I knew 
> I could run that command I would already have the information I need :P

Surely you could just test for the effective user id of the current 
user?   Should be root/0 if they're running your script with sudo.

Or is the aim of your script to do something with sudoers?

-- 
Chris Bannister
  email: cj at moodog.org.uk
jabber: cj at bluelinux.co.uk




More information about the ubuntu-users mailing list