There are two ways to get the current user's home directory.
- One way is to look at the user's passwd entry (in
/etc/passwd
).
- Another way is to look at the
HOME
environmental variable. $HOME
is actually set from the passwd entry. Applications that may set it include your terminal emulator, your login manager, and sudo.
The applications that you are unable to fool may be looking at the user's passwd entry. It is also possible that they are storing the user's home directory somewhere (possibly as part of an absolute path to some file or directory) and ignoring both HOME
and the passwd entry.
One way to check if an application uses the HOME
environmental variable is to grep for it. For example, grep HOME /usr/bin/pdftex
will return Binary file /usr/bin/pdftex matches
, meaning pdftex
might use $HOME
.
For more definite answers, look through the application's source code.
Use grep -r 'getenv\s\?(.*HOME'
to speed up the source code analysis a bit.