I expected the -H option to give me the target user's environment.
nbest@geo:~$ sudo -H -u tanum echo $HOME
/home/nbest
nbest@geo:~$ sudo -u tanum echo $HOME
/home/nbest
nbest@geo:~$ sudo -i -u tanum echo $HOME
/home/nbest
nbest@geo:~$ sudo -H -i -u tanum echo $HOME
/home/nbest
This would allow me to say:
sudo -u tanum ls ~
and get the target user's home directory listing. Not the case. Is this caused by the env_reset
default in sudoers
?
If so does -H have any effect? What is the safest way to override this behavior?
If not what is the intended effect of -H?
Please set me straight.