Fixing fork and sshd in cygwin
Saturday, 14 July 2007
I decided to go crazy and arm my computer with all I needed to access everything from any Internet-connected computer, including stuff like VNC. Naturally, I wanted this to be secure, both to prevent unauthorized access and to maintain my privacy.
I figured the best way to do it would be to set up a SSH server on my computer. This way, I could not only login remotely but also tunnel ports securely through the Internet. Because my computer runs Windows, I had installed Cygwin so I had have a Unix environment at my disposal. (My Mac already has the Unix stuff on there, and it’s somewhat analagous to Cygwin). I followed the easy instructions on how to setup sshd on Cygwin.
However, when I tried to login with “ssh localhost”, it kept giving me the error:
ssh_exchange_identification: Connection closed by remote host
A Google search showed me that several people had the same error, but they didn’t have the same problem as I did.
I looked in /var/log/sshd.log and saw stuff like:
sshd 3844 fork: child -1 – died waiting for longjmp before initialization, retry 0, exit code 0xC0000022, errno 11
for every time that I tried to connect. Apparently, sshd couldn’t fork new processes. This pointed to some internal errors.
Rebaseall didn’t help. Neither did disabling Windows Firewall. Nor did downgrading openssh.
However, cygcheck showed me the problem.
Running “cygcheck -s | less”, it gave me a warning about having multiple cygwin1.dll’s in my PATHs.
Google Desktop showed me I had no less than 4 copies cygwin1.dll on my computer that were all different versions and were in my PATH (where the system looks for executibles). Bad, bad, bad. I either deleted or replaced the other cygwin1.dlls.
Fixed. Just make sure you only have one cygwin1.dll.