obar1
6/4/2018 - 1:01 PM

sudo_with_vars

use sudo in ubuntu with env vasr

sudo does not normally preserve local environment variables. You should use it with the -E switch to do so, i.e. sudo -E su will preserve $MYVAR for root.

Alternatively, to create persistent variables that are truly system-wide, you should set them in /etc/environment.

shareedit