Subject: Possible Workaround - SSH/SSHD: could not chdir to home directory: No such file or directory
From: Philip Flip Kromer <[email-masked]>
To: [email-masked]
Date: Fri, 05 Apr 2002 02:01:52 -0600
Newsgroups: gmane.os.cygwin

Hello,

I followed the recipe for setting up sshd under cygwin at
	http://tech.erdelynet.com/cygwin-sshd.asp

Everything worked swimmingly, except..
   tick:~$ ssh me@localhost
   me@localhost's password:
   Fanfare!!!
   You are successfully logged in to this server!!!
   Could not chdir to home directory /h/me: No such file or directory

..for the error message about not being able to find the home directory. 
sshd would still log me in, and would still set me in my home directory 
(which does exist).  The only problem (besides just annoyance) is that 
it also would not find my ~/.ssh to do RSA authentication with.

Some other people have reported this error; see
   http://www.cygwin.com/ml/cygwin/1999-09/msg00276.html
   http://www.cygwin.com/ml/cygwin/2000-09/msg00032.html
   http://www.cygwin.com/ml/cygwin/2000-10/msg00758.html
   http://www.cygwin.com/ml/cygwin/2000-11/msg01274.html

Nobody seems to have posted a fix or reason for the error; but if I run 
sshd under my account, rather than the SYSTEM account, it finds the home 
directories and RSA authentication works.

I ran
   $ cygrunsrv -R sshd

to stop the ssh daemon, then

   $ chmod me:users /var/log/sshd.log
   $ cygrunsrv -I sshd -d "SSHD" -p /usr/sbin/sshd -a "-D" -u Me \
         -e "CYGWIN=binmode ntsec tty"
   $ cygrunsrv -S sshd

to load and start the new sshd. I also made sure I had "Log on as
Service" rights on the local machine.

1) Is it in any way a bad idea to run sshd as a local user?
2) Why was the SYSTEM account not successfully finding my home dir?
    It is mounted on a FAT32 partition, so I don't think it's a
    permissions issue. I also tried various combinations of dirs in
    /etc/passwd.

Well, if you're having this problem see if it helps to do this; and if I 
am doing a Dumb Thing please let me know. My configuration info is below.

Cheers,
flip

--------------------------------------------------------------------------
My /etc/passwd, system IDs elided:
   everyone:*:0:0:,S-1-1-0::
   system:*:18:18:,S-1-5-18::
   admins:*:544:544:,S-1-5-32-544::
   admin:*:500:544:U-HOST\Administrator,S-1-5-21-...-500:/h/me:/bin/bash
   me:*:1003:544:U-HOST\me,S-1-5-21-...-1003:/h/me:/bin/bash
   guest:*:501:513:U-HOST\Guest,S-1-5-21-...-501:/h/guest:/bin/false

my /etc/group
   everyone:S-1-1-0:0:
   system:S-1-5-18:18:
   none:S-1-5-21-...-513:513:
   adminis:S-1-5-32-544:544:
   guests:S-1-5-32-546:546:
   powers:S-1-5-32-547:547:
   users:S-1-5-32-545:545:
   usercyg:S-1-5-21-...-1201:1201:

--------------------------------------------------------------------------
Environment variables [Control Panel/System Properties/System variables]:

   SHELL    /bin/bash.exe
   HOME     /h/me
   CYGWIN   binmode ntsec tty

--------------------------------------------------------------------------
Output of "cygcheck -s":

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Fri Apr 05 01:43:24 2002

Windows XP Professional Ver 5.1 Build 2600

Path:   C:\unix\bin
         C:\unix\sbin
         C:\unix\bin
         C:\unix\usr\local\bin
         C:\unix\usr\X11R6\bin
         c:\apps\utils
         c:\windows
         c:\windows\system32
         c:\windows\system32\wbem
         c:\apps\Applications\Matlab\bin\win32

SysDir: C:\WINDOWS\System32
WinDir: C:\WINDOWS
CYGWIN = `binmode ntsec'
HOME = `h:\me'
LD_LIBRARY_PATH = `\lib:\usr\lib\:\usr\local\lib:\usr\X11R6\lib\'
MAKE_MODE = `unix'
PWD = `/h/me'
USER = `me'

Use `-r' to scan registry

a:  fd           N/A    N/A
c:  hd  NTFS    4996Mb  84% CP CS UN PA FC     Chairface
f:  net NTFS   51677Mb  65% CP CS    PA        me
h:  hd  FAT32   9654Mb  60% CP    UN           THRAKKORZOG
m:  hd  FAT32  23285Mb  90% CP    UN           MRMENTAL
r:  cd           N/A    N/A
u:  net NTFS   51677Mb  65% CP CS    PA        users

.            /         user    binmode,noumount
C:/unix      /         system  binmode
C:/unix/bin  /usr/bin  system  binmode
C:/unix/lib  /usr/lib  system  binmode

Found: C:\unix\bin\bash.exe
Found: C:\unix\bin\cat.exe
Found: C:\unix\bin\cpp.exe
Found: C:\unix\bin\find.exe
Found: C:\unix\bin\gcc.exe
Found: C:\unix\bin\gdb.exe
Found: C:\unix\bin\ld.exe
Found: C:\unix\bin\ls.exe
Found: C:\unix\bin\make.exe
Found: C:\unix\bin\sh.exe

    56k 2000/12/03 C:\unix\bin\cygbz21.0.dll
   621k 2002/01/16 C:\unix\bin\cygcrypto.dll
    45k 2001/04/25 C:\unix\bin\cygform5.dll
    35k 2002/01/09 C:\unix\bin\cygform6.dll
    19k 2002/02/20 C:\unix\bin\cyggdbm.dll
    17k 2001/06/28 C:\unix\bin\cyghistory4.dll
    20k 2002/01/13 C:\unix\bin\cyghistory5.dll
    22k 2001/12/13 C:\unix\bin\cygintl-1.dll
    22k 2002/01/29 C:\unix\bin\cygintl.dll
    81k 2001/10/20 C:\unix\bin\cygitcl30.dll
    35k 2001/10/20 C:\unix\bin\cygitk30.dll
    25k 2002/03/17 C:\unix\bin\cygltdl-3.dll
    26k 2001/04/25 C:\unix\bin\cygmenu5.dll
    20k 2002/01/09 C:\unix\bin\cygmenu6.dll
   156k 2001/04/25 C:\unix\bin\cygncurses++5.dll
   175k 2002/01/09 C:\unix\bin\cygncurses++6.dll
   226k 2001/04/25 C:\unix\bin\cygncurses5.dll
   202k 2002/01/09 C:\unix\bin\cygncurses6.dll
    15k 2001/04/25 C:\unix\bin\cygpanel5.dll
    12k 2002/01/09 C:\unix\bin\cygpanel6.dll
    40k 2001/11/21 C:\unix\bin\cygpcre.dll
    39k 2001/11/21 C:\unix\bin\cygpcreposix.dll
   108k 2001/06/28 C:\unix\bin\cygreadline4.dll
   121k 2002/01/13 C:\unix\bin\cygreadline5.dll
    66k 2001/11/20 C:\unix\bin\cygregex.dll
   156k 2002/01/16 C:\unix\bin\cygssl.dll
   253k 2002/02/10 C:\unix\bin\cygtiff3.dll
   623k 2001/10/20 C:\unix\bin\cygtk80.dll
    50k 2002/03/12 C:\unix\bin\cygz.dll
   751k 2002/02/25 C:\unix\bin\cygwin1.dll
     Cygwin DLL version info:
         DLL version: 1.3.10
         DLL epoch: 19
         DLL bad signal mask: 19005
         DLL old termios: 5
         DLL malloc env: 28
         API major: 0
         API minor: 51
         Shared data: 3
         DLL identifier: cygwin1
         Mount registry: 2
         Cygnus registry name: Cygnus Solutions
         Cygwin registry name: Cygwin
         Program options name: Program Options
         Cygwin mount registry name: mounts v2
         Cygdrive flags: cygdrive flags
         Cygdrive prefix: cygdrive prefix
         Cygdrive default prefix:
         Build date: Mon Feb 25 11:14:34 EST 2002
         Shared id: cygwin1S3

Cygwin Package Information
Package             Version
ash                 20020131-1
  ...
bash                2.05a-3
  ...
cygrunsrv           0.95-1
cygutils            1.0.0-1
cygwin              1.3.10-1
  ...
openssh             3.1p1-1
openssl             0.9.6c-2

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/