[sudo-users] Enable "-i" environment cleaning w/o being interactive?

Beckett Madden-Woods BWoods at factset.com
Wed Feb 21 16:14:44 EST 2007


Hello.

I'm looking for a way to run a noninteractive command with sudo, but still 
having the environment cleaning that I get with the "-i" flag where the 
*runas* user's environment is set.

In the env.c code, it seems the only way to load the runas user's 
variables is to have MODE_LOGIN_SHELL set, which has the undesired 
side-effect of loading an interactive shell and not accepting an arbitrary 
command. I can get the additional cruft cleaned out by setting an 
"env_reset" flag in the sudoers file, but that still doesn't get me the 
runas user's HOME/USER/LOGNAME/... variables.

Can anybody think of a clever way to circumvent the interactivity of "-i" 
so I can run a noninteractive command with "-i", or barring that, might it 
be worthwhile my adding a patch for another command line switch for this 
functionality?

Bright ideas or general advice much appreciated!

Regards,
-Beckett

-- 
Beckett Madden-Woods   -   bwoods at factset.com
Senior Software Engineer   -   News Services
FactSet Research Systems, Inc.   -   www.factset.com



More information about the sudo-users mailing list