I have a specific problem. Here's a simplified example:
File /opt/test
is owned by root. Has file permissions of 700
.
I need to cp /opt/test /home/user/
.
So I need this exact command set in my sudoers file. I can't open up permissions to any other command.
But if I put this as a NOPASSWD
command in /etc/sudoers
it doesn't work because my user does not have permissions to see /opt/test
before it su
's to the root user (sudo
is 'globbing' or whatever the file paths before it runs an su
to root
).
How can I invoke this command in a subshell or something so that I can get the exact command laid out in /etc/sudoers
? Putting the command in a script and then laying out the path to the script in sudoers
fails (permissions). I think I need to invoke a subshell of sorts, but don't know how to lay that out in sudoers
.