Ssh ignores $HOME

Corinna Vinschen
Wed Dec 29 12:52:00 GMT 2004

On Dec 29 14:14, Ehud Karni wrote:
> On Tue, 28 Dec 2004 22:39:42 -0500, Pierre A. Humblet <XXXXXX.XXXXXXt@XXXX.XXX> wrote:

> > See last sentence in
> >
> This last sentence needs a correction: If there is no /etc/passwd ssh
> will use the supplied$ HOME.
> I would replace the faq sentence with: "Note that ssh disregard `HOME'
> if /etc/passwd does exist."
> I have checked this situation many times, as I make a minimal ssh
> distribution (that can be run from a CD/flash) that run on machines
> where Cygwin is not installed (and consequently - no mounts and
> no /etc/passwd).

Well, it's a bit more tricky than that.  On a non-Cygwin system you'd
see it immediately.  On Cygwin it's different since Cygwin *fakes* an
/etc/passwd entry for the current user if it can't find /etc/passwd.
While doing that, it evaluates the pw_dir entry by looking for $HOME in
the current environment.  If there's no $HOME, it looks for $HOMEDRIVE
and $HOMEPATH instead.

On my system $HOME doesn't exist, so it looks for $HOMEDRIVE and $HOMEPATH.
These variables still point to the Windows default home directory, which
I don't use under Cygwin.  Consequentially the faked pw_dir entry points
to a directory which has no .ssh subdir.  As a result, ssh doesn't find
any key files etc.

So, even though it looks different on Cygwin, ssh does actually not use
the value of $HOME.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader
Red Hat, Inc.

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list