Bugzilla – Bug 154
option to use the target user's environment (like 'su -')
Last modified: 2004-10-14 15:31:01 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.
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.