[sudo-users] sudo -u username script ENV problem

Christopher Jackson jackson.christopher.lee at gmail.com
Mon Nov 22 02:41:58 EST 2010

I am having a strange problem with two servers at home. I have one server in place that functions properly, I have tried bringing up another server to repeat the same functions as the first server but run into one small problem with sudo.

I try to run a script via user1 who has sudo access as user2, the command appears below:

[user1 at server2 ~]$ sudo -u user2 script.sh

script.sh relies on env variables that are set by user1 and on envVariables that are in /etc/profile.d/startUpEnv.sh

Like I said it works fine on server1 but not on server2. I know its a problem of env variables not being set. because when i run "sudo -u user2 env" the env is different from when i just run env as user1. I checked that /etc/sudoers is exactly the same on both machines. so are the startUpEnv.sh files. 

Any thought on how to resolve this issue would be greatly appreciated.

More information about the sudo-users mailing list