dimanche 1 mars 2015

su or sudo keeping/removing certain environment variables


I would like to be able to log in as another user and keep most, but not all of my environment. Specifically, I would like to set $HOME to the correct value for the new user, but keep probably everything else. If I use sudo -E, all of my environment stays the same, including $HOME. If I use sudo -E su, it almost works, but for some reason doesn't preserve $ZDOTDIR, which is specifically one of the variables I want to keep.


Does anyone know a convenient solution to this, or why one of the few variables that gets wiped with sudo -E su is $ZDOTDIR? Thanks.



Aucun commentaire:

Enregistrer un commentaire