Quote:
Originally Posted by
fpmurphy
When a user logs in using login(1) login sets the $HOME environmental variable. The shell uses that environmental variable to find a users home directory.
AFAIK, there is no single API which will check whether a login is known to all authentication methods (local, NIS, PAM, etc.) used on a particular system.
Thanks for your answer.
That is true for the current user, who is obviously logged in. However, if I have an existing user, say bob with HOME=/home/bob, on a system, then anyone will see ~bob expanded to /home/bob in their shell. Without that bob has ever logged in (and so called login(1)), and regardless of the authentication method as far as I could experiment...
On the other hand, if bob doesn't exist, then ~bob won't expand.
So the shell knows whether a user exists or not... the question is how?
which I should find in the sources