Subject: Re: ssh doesn't like $HOME
From: "Ehud Karni" <[email-masked]>
To: [email-masked]
Date: Wed, 30 Apr 2003 12:49:02 +0300

On Tue, 29 Apr 2003 19:17:59 +0200, Corinna Vinschen <[email-masked]> wrote:
> 
> On Tue, Apr 29, 2003 at 07:49:51PM +0300, Ehud Karni wrote:
> > On Tue, 29 Apr 2003 17:49:26 +0200, Corinna Vinschen <[email-masked]> wrote:
> > > ssh never uses the $HOME value.  It uses the home dir given in the user's
> > > /etc/passwd entry.
> > 
> > - From my experience (without reading the source) this is not exactly
> > true. If the /etc/passwd file exists it is used, but if it does not
> > exist, the $HOME is used. You can check it by using the -v (debug
> > switch) for ssh:
> 
> It only uses $HOME when trying to evaluate `~' (tilde) in a path. 

NO. it is using $HOME also for the .ssh directory.

I'm running it like this: ssh -v target
and ssh finds my config file and key that are under $HOME/.ssh .

Here are some relvant parts of the strace:
1. getting HOME from the Windows environment -
   55    3488 [main] ssh 2016 path_conv::check: root_dir(c:\), this->path(c:\tty), set_has_acls(8)
   54    3542 [main] ssh 2016 win_env::add_cache: posix /cygdrive/c/tty
   50    3592 [main] ssh 2016 win_env::add_cache: native HOME=c:\tty
   50    3642 [main] ssh 2016 posify: env var converted to HOME=/cygdrive/c/tty
   92    3734 [main] ssh 2016 environ_init: 0x100F0610: HOME=/cygdrive/c/tty
   94    3828 [main] ssh 2016 environ_init: 0x100F0848: HOMEDRIVE=C:

2. Using $HOME when reading /etc/passwd fails (for the ~ expansion)
   59   33942 [main] ssh 2016 pwdgrp::load: /etc/passwd
   52   33994 [main] ssh 2016 pwdgrp::load: strange path_conv problem
   51   34045 [main] ssh 2016 pwdgrp::load: /etc/passwd load failed
  121   34166 [main] ssh 2016 cygheap_user::ontherange: what 2, pw 0x0
   57   34223 [main] ssh 2016 cygheap_user::ontherange: HOME is already in the environment /cygdrive/c/tty

3. Trying to read config file -
   53  103617 [main] ssh 2016 pwdgrp::load: /etc/passwd
   53  103670 [main] ssh 2016 pwdgrp::load: strange path_conv problem
   52  103722 [main] ssh 2016 pwdgrp::load: /etc/passwd load failed
       ...
73334  177974 [main] ssh 2016 isatty: 1 = isatty (0)
  153  178127 [main] ssh 2016 open: open (/cygdrive/c/tty/.ssh/config, 0x0)
       ...
   55  179458 [main] ssh 2016 open: 3 = open (/cygdrive/c/tty/.ssh/config, 0x0)

4. Trying to read identity/id_dsa -
   56 8619035 [main] ssh 2016 pwdgrp::load: /etc/passwd
   55 8619090 [main] ssh 2016 pwdgrp::load: strange path_conv problem
   54 8619144 [main] ssh 2016 pwdgrp::load: /etc/passwd load failed
  146 8619290 [main] ssh 2016 open: open (/cygdrive/c/tty/.ssh/identity, 0x10000)
       ...
   60 8623388 [main] ssh 2016 open: -1 = open (/cygdrive/c/tty/.ssh/identity, 0x0)

   56 8637500 [main] ssh 2016 pwdgrp::load: /etc/passwd
   54 8637554 [main] ssh 2016 pwdgrp::load: strange path_conv problem
   55 8637609 [main] ssh 2016 pwdgrp::load: /etc/passwd load failed
  137 8637746 [main] ssh 2016 open: open (/cygdrive/c/tty/.ssh/id_dsa, 0x10000)
       ...
   57 8639107 [main] ssh 2016 open: 4 = open (/cygdrive/c/tty/.ssh/id_dsa, 0x10000)

Ehud.

- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:[email-masked]                  Better  Safe  Than  Sorry

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/