I am struggling with sudo and environmental variables. I feel like i'm
missing something silly and just need another set of eyes.
I have a situation where i need a user(userA) to run a script using sudo as
another user (userB). I want to use some environmental variables from
userB (script owner) for the purpose of the script. Specifically $PATH and
HTTP_PROXY. I have the PATH and HTTP_PROXY set in /home/userB/.bashrc but
when userA uses sudo -u userB script it doesn't pickup those environmental
variables. I tried using the sudo options and set env_keep+="HTTP_PROXY"
and that still didn't work. The only thing i found worked so far was
adding. i've also tried the sudo -i option and that fails.
Thanks in advance.
[megantest@tools-dit ~]$ sudo -ll
Matching Defaults entries for megantest on this host:
requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS
HISTSIZE INPUTRC KDEDIR LS_COLORS", env_keep+="MAIL PS1 PS2 QTDIR
LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION
LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER
env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin, passprompt="Enter RSA
User megantest may run the following commands on this host:
SSSD Role: script_testing
Manage your subscription for the Freeipa-users mailing list:
Go to http://freeipa.org for more info on the project