[sudo-users] sudo -u username script ENV problem

Todd C. Miller Todd.Miller at courtesan.com
Tue Nov 30 11:11:45 EST 2010

By default, recent versions of sudo will run commands with a fresh
copy of the environment that only preserves certain variables.

It sounds like sudo on the first server is configured to preserve
the environment of the user but the second server is not.

You can configure which variables are preserved in sudoers using
lines like:

    Defaults env_keep += "VAR1 VAR2 VAR3"

or simply revert to the old behavior of keeping all variables
except for those that are blacklisted:

    Defaults !env_reset

 - todd

More information about the sudo-users mailing list