Tuesday, November 3, 2009

sudo Resets PATH Environment Variable

After setting the proper path for your user account, you can use the -E switch to have sudo preserve the user environment.

From the man page:

-E  The -E (preserve environment) option will override the env_reset option in sudoers(5)).  It is only available when either the matching command has the SETENV tag or the setenv option is set in sudoers(5).

To whit:

$ sudo -s -E