In the manpage of sudo I found the
-H option, but I don't seem to understand how it works. The manpage says:
The -H ( HOME ) option sets the HOME environment variable to the homedir of the target user (root by default) as specified in passwd(5).
In my understanding, the following should not happen:
root $ sudo -u sztomi -H echo $HOME /root
But instead it should output
/home/sztomi which is the home directory of the user sztomi.
How can I do this right?