Bug 158 - enhance -l option
enhance -l option
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.6.6
PC Linux
: normal enhancement
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-13 18:13 MST by Fred Hansen
Modified: 2004-11-24 17:01 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Hansen 2004-11-13 18:13:32 MST
In a script I am writing I want to find out if the user has permission to run a
particular command (chown). I propose that the -l command be augmented to permit
a list of commands:
            sudo -l /bin/ch* /bin/date
Then the returned value would be a list of those commands which the user has
permission to execute. If we suppose that the user of the above command has not
been given permission to run 'date', the result of the above would be:
            /bin/chown /bin/chmod /bin/chgrp

Fred Hansen

I am willing to code this myself if it will help.
Comment 1 Todd C. Miller 2004-11-15 09:17:00 MST
Something like this shouldn't be too hard to do with the new parser currently in cvs.  However, it's not 
really possible to pass in a list of commands since there is no good way to tell what is a command 
and what is an argument to a command.  Ie: "sudo -l /bin/ls foo" should be possible.
Comment 2 Todd C. Miller 2004-11-24 13:01:48 MST
Something similar to this will appear in sudo 1.7, though it is only possible to do a single command.  
E.g.
    % sudo -l chmod 644 /etc/motd
    /bin/chmod 644 /etc/motd

The -u flag can be used in conjunction with this too.