Bugzilla – Bug 158
enhance -l option
Last modified: 2004-11-24 17:01:48 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.
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.
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.