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 22C:\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
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.
Thank you
@HopelessN00b
,@user155148
,@Algomorph
a combination of your solutions got me going.The Crux
I had two problems:
cygwin1.dll
files./var/log/sshd.log
: "Privilege separation user sshd does not exist"My Fix
Deal with the duplicate pickle files:
Added a user by editing
/etc/passwd
and adding the following line:Note that the username 'sshd' came from
/var/log/sshd.log
.I did find one other resource, this one a bit more verbose and from Oracle
In a nutshell, if you are having greif:
...make the fix
.....run
cygrunsrv -S sshd
.......curse profusely
...Do you have duplicate dll files??
/var/log/sshd.log
...Do you have
/etc/passwd
probs?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!
I had some privilege separation problem. In this case adding a line to
/etc/passwd
file solved the problem.For me it turned out to be a compatibility issue. I was trying to run it in Win7. Fixed by right clicking the file in explorer, going to compatibility and setting compatibility to Windows Server 2003. Worked fine after that.
Found the solution here:
http://h30499.www3.hp.com/t5/Windows-Server-2008/Installing-OpenSSH-on-Windows-server-2008/td-p/4777839#.U0cmzle2wuI
Note that my issue was related specifically to trying to launch OpenSSH Server which uses a light version of Cygwin I guess.
I use a local account, cyg_server, to run sshd. I needed to set the permissions on /var/empty to 700 and the owner to cyg_server, despite the fact that the error message said that the owner needs to be root.
I also removed the message of the day (/etc/motd), but I don't think that this is strictly necessary. It sometimes gets in the way of my automation.
FWIW, cyg_server is a strictly local user with admin privileges and no Active Directory definition. It is listed in the registry and in /etc/passwd.
I also had to edit the rights of cyg_server after accepting a recent Cygwin update.
stopped sshd, changed the service account's rights and restarted sshd.
This is how the rights are set after this quick session.
The /etc/passwd response was very close, but the UID 74 was specific to his installation.
instead use this cygwin command to grab the correct UID.
This seems to be caused by ANY error with the sshd server - in my case it barfed on
/etc/ssh_host_rsa_key
perms - should be 0600. look in/var/log/sshd
or similar.On a client system I found a program called RDPlus (www.rdplus.com.au) running an SSH tunneling option on port 22 that I had to disable before Cygwin sshd would start. From CMD.EXE, 'netstat -abo' pointed at this process after finding an 'Bind to port 22 on 0.0.0.0 failed' error in the Application Event Log. The 'o' option will show the PID which can be found in Task Manager.
To disable this run the RDPlus admin tool, go to the Web tab and disable SSH Tunneling.
Someone posted this on another Stack Exchange question, but in case you have a empty file in
/var/log/sshd
, you should try/usr/sbin/sshd
. This will output the errors you didn't get in the log.For me, unistalling the sshd services, rebooting and then re-running ssh-host-config, while following these instructions, helped (
ls -l /var/etc
told me that in my first attempt, the empty folder was owned by SYSTEM, which makes sense, since I followed this tutorial previously. However, this way, I got a "/var/empty must be owned by root and not group or world-writable" error).