How to get rid of QueryServiceStatus: Win32 error 1062 when you try to start sshd on Cygwin?
I installed Cygwin and sshd on Windows 7 but I'm not able to make it work.
I followed the guide from http://www.noah.org/ssh/cygwin-sshd.html but I still get:
$ cygrunsrv -S sshd
cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062:
The service has not been started.
Configuration details:
- Windows 7 in a domain running with a domain user that has local administrative priviledges
-
netstat -a -b
reports nothing running on port 22 -
C:\cygwin\var\log\sshd.log
is empty - After I installed cygwin and sshd, I run
ssh-host-config -y
- Already tried to add SYSTEM account to the 3 directories, no change.
- Already tried a full system reboot, no change
Update: Windows logs complains about Possible duplicate cygwin1.dll
Solution 1:
Thanks, Your update was the resolution - for anyone else out there, there is a recipe #3 against Win32 error 1062 at Cygwin startup:
1) Check the Application Event log, see if there are "Information"-level events there with something like: "sshd: PID : Possible duplicate cygwin1.dll:"
Find that silly duplicate at the specified location and rename it or get rid of it from the path somehow. Mine was at "/cygdrive/c/Program Files (x86)/socat-1.7.2.0/cygwin1.dll."
Boo, socat! Apparently they engage in 3PP. Didn't even know socat was on my system, apparently it came as a part of some other installation. I found 2 other people in the cygwin mailing lists having suffered from the duplicate-dll problem.
Solution 2:
Thank you @HopelessN00b
, @user155148
, @Algomorph
a combination of your solutions got me going.
The Crux
I had two problems:
- Duplicate
cygwin1.dll
files. -
/var/log/sshd.log
: "Privilege separation user sshd does not exist"
My Fix
-
Deal with the bloody duplicate pickle files:
cd /cygdrive/c/Program\ Files\ \(x86\)/cwRsync/bin mv cygwin1.dll cygwin1_.dll
-
Added a user by editing
/etc/passwd
and adding the following line:sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
Note that the username 'sshd' came from /var/log/sshd.log
.
GAD what a pain in the arse this is!
I did find one other resource, this one a bit more verbose and from Oracle
In a nutshell, if you are having greif:
- Run each of these steps ONE. AT. A. BLOODY. TIME.
...make the fix
.....runcygrunsrv -S sshd
.......curse profusely - Check the Windoze event logs.
...Do you have duplicate dll files?? - Take a look at
/var/log/sshd.log
...Do you have/etc/passwd
probs?
Solution 3:
I had (almost) the same effect and an analogous solution: Application log showed a duplicate file
Possible duplicate cygwin1.dll: /cygdrive/c/dakota/bin/cygwin1.dll..
from my dakota installation. Renaming this dll did the trick. Thank you!
Solution 4:
I had some privilege separation problem. In this case adding a line to /etc/passwd
file solved the problem.
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin