Bug 154

Summary: option to use the target user's environment (like 'su -')
Product: Sudo Reporter: Michael <sidlon>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: normal    
Version: 1.6.6   
Hardware: PC   
OS: All   
URL: http://www.sudo.ws/mailman/htdig/sudo-users/2002-March/001006.html

Description Michael 2004-10-14 11:27:08 MDT
I think sudo very badly needs a cmdline flag to have a job run in the target 
user's (normally root's) environment, much like the standard command 'su -'.

  Currently, I can't reliably re/start apache under sudo, since 'sudo /etc/init.
d/httpd restart' applies my personal environment variables (LD_LIBRARY_PATH, 
etc) to the httpd process.  Another use case would be to enable basic commands 
like 'sudo useradd foo' instead of 'sudo /usr/sbin/useradd foo'.

  I think it may be common for sysadmin's to let some users be able to restart a 
webserver, but not have full root access.  In a case like that, it currently 
just isn't possible for the user to start httpd cleanly.
Comment 1 Todd C. Miller 2004-10-14 11:31:01 MDT
See the -i flag in sudo 1.6.8p1.  You can also specify that sudo should throw away the current 
environment and use a minimal one with the env_reset sudoers option.