How to avoid specifying full path in sudoers file?
Posted
by
s g
on Server Fault
See other posts from Server Fault
or by s g
Published on 2013-07-02T05:45:57Z
Indexed on
2014/06/01
15:32 UTC
Read the original article
Hit count: 145
I am trying to add a NOPASSWD
entry for sudotest.sh
(or any script/binary that requires sudo) in my /etc/sudoers
file (on Ubuntu 12.04 LTS server), but in order to make it work, I must specify the full path. The following entry works just fine:
%jenkins ALL=(ALL)NOPASSWD:/home/vts_share/test/sudotest.sh
The problem is that the script might move to a different directory. This seems like a great chance to use the *
wildcard in the path (i.e. /*/sudotest.sh
) so that my script could be in any directory but the manual states that wildcards will not match the /
character when used in a path. I've confirmed that it doesn't work.
I know that I can use the word ALL
in place of my script, but this means there is no password prompt for any commands which seems unsafe.
How do I solve this?
© Server Fault or respective owner