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