Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Question about sudo

$
0
0
Hello all,
I have a script (script.sh) that is owned and executed by root. Now I need to give another user (user1) sudo access to execute that script.
I edited the /etc/sudoers file, and created the following:

Code:

# Runas alias specification
Runas_Alias RO = root
 
user1      ALL=(RO) NOPASSWD: /usr/bin/script.sh

My question is: How can I make it so when user1 runs the script, it uses the same environmental variables as root?

I read about this option: Defaults env_keep, but in this case I don't know exactly how many environmental variables I need to keep.
Is there any way that I can keep all the environmental variables of root when user1 uses sudo to execute the script?
Thank you!

Viewing all articles
Browse latest Browse all 16232

Trending Articles