We have a number of script (for Openstack operations) which require privileged execution in our environment. For some of the scripts we'd like to refer back to the USERNAME or UID of the person who initiated the sudo session.
sudo already presents us with SUDO_UID, SUDO_USER environment settings. This also works fine when using sudo -s to start a shell session. However, if I use sudo -i or sudo su - then these settings are scrubbed from the environment.
Is there anything I can put into the /etc/sudoers or /etc/sudo.conf (perhaps even a "PLUGIN") which can allow me to start an interactive shell via sudo with root's environment initialized but ALSO with these specific SUDO_* settings preserved?
0 Answers