How to configure sudoers with path wildcards?
- by C. Lee
I need sudo for a command for any path under a particular area. Example:
sudo mycommand /opt/apps/myapp/...
What is the sudoers syntax to allow this command to run in any path that falls under /opt/apps/myapp? This is Solaris 10 sudo.
Thank you for your reply, but I don't need wildcards for the path to the commands, but wildcards for the arguments for the commands.
For example, we want to do something like...
sudo mycmd /opt/userarea/area1
sudo mycmd /opt/userarea/area1/area2
sudo mycmd /opt/userarea/area1/area2/area3
So far, using wildcards for the arguments in sudoers look like this:
/opt/userarea/*
/opt/userarea/*/*
And it seems like if we want to have N levels of directories, then we need N lines in sudoers! Is there a better way to include all N levels in one line in sudoers? Thanks.