The sudo manpage tells me, that I can preserve the environment by passing the
-E option, which does not work in the case of
> env | grep TMPDIR TMPDIR=/localdata/tmp > sudo env | grep TMPDIR [no output] > sudo -E env | grep TMPDIR [no output]
This option is not blacklisted, that is
sudo sudo -V doesn't list it as "Environment variables to remove". Following the approach proposed in an answer the the question "How to specify root's environment variables", I tried to whitelist it, that is my
Defaults env_reset Defaults env_keep = "TMPDIR"
This doesn't work neither, it actually doesn't even make
TMPDIR appear in the whitelist (that is, what
`sudo sudo -V prints as "Environment variables to preserve".
(I'm running Ubuntu 10.04.)