Some time ago I posted a question which was related to whether it is possible to preserve environment variables when sudo
ing to a different user. As it turned out, this is indeed possible.
When invoking gksudo
today to execute a GUI application as the root user, I was expecting that the preservation of environment variables (in my case $HOME
) would also work for gksudo
as it is configured via the same file, namely /etc/sudoers
. As it turned out, this does not seem to be the case.
For example, executing sudo vim
will start up an instance of vim
, correctly getting the configuration from the invoking user's home folder because I configured sudo
to preserve $HOME
. But gksudo gvim
will fire up a "vanilla" gvim
instance.
Is it necessary to separately configure gksudo
to achieve what I want?