How to configure sudoers with path wildcards?
Posted
by
C. Lee
on Super User
See other posts from Super User
or by C. Lee
Published on 2010-04-09T22:11:52Z
Indexed on
2013/06/27
4:25 UTC
Read the original article
Hit count: 289
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.
© Super User or respective owner