[sudo-users] Force sudo to source environment file before running a command.

Techie techchavez at gmail.com
Tue Oct 20 10:31:11 EDT 2009


Hello,
Is it possible to force sudo to source a users environment file or any
environment file with "env_file" while running a command.
I have set a User_alias, Runas_Alias, Cmnd_Alias, and user privilege
for a user as follows.


User_Alias TSTU = techie
Runas_Alias TSTA = operator
Cmnd_Alias TSTCMD = <commands to run>

TSTU ALL = (root) TSTCMD, (TSTA) <commands that need environment>

So all the commands defined in the TSTCMD Cmnd_Alias will be run as
root.. However for the commands run by the TSTA Runas_Alias AKA the
operator user...I need to source an environment file. This file is a
bash style environment file with statements like.

export FAVCOLOR=red
export DOG=boxer

Can I use the env_file parameter to accomplish this?  If so please
provide a syntax example. From the manpage it says it is possible but
no example.

Thank you much.



More information about the sudo-users mailing list