Unable to start cygwin sshd service
Asked Answered
S

5

26

I entered ssh-host-config into the cygwin prompt (started with admin privileges), said yes to privilege separation, new local account sshd, install sshd as a service; I entered no value for CYGWIN for daemon; I entered no for using a different name; yes for creating new privilege user account.

In my services.msc I am unable to start the service:

The CYGWIN sshd service on Local Computer started and then stopped. 
Some services stop automatically if they are not in use by other services
or programs.

In the cygwin prompt, net start sshd produces:

The CYGWIN sshd service could not be started. 
The service did not report an error.
More help is available by typing NET HELPMSG 3534

In the cygwin prompt, cygrunsrv -S sshd produces:

cygrunsrv: Error starting a service: QueryServiceStatus:  Win32 error 1062:
The service has not been started.

My /var/log/sshd.log says the following:

Unable to initialize device PRN

I've searched the questions on SO related to this issue, as well as the general Internet, and I guess what makes my question unique has to do with the sshd.log. I can't find anyone else who has received this.

I'm doing this to install Hadoop on my Windows. I cannot run a virtual machine on this slow computer as everything just bogs down.

Soubise answered 19/7, 2013 at 0:10 Comment(1)
I have exactly same problem in windows 7. I've followed various link but the problem still exists. Some of the links I've followed are: ebiquity.umbc.edu/Tutorials/Hadoop/00%20-%20Intro.html, gist.github.com/tariqmislam/2159173. Anybody reading this kindly provide a solution.Monocyte
W
20

I followed the steps in this topic and the problem was still happening, then I checked the sshd log file and it was complaining that the privilegies of the ssh private key were to open.

I executed the follow command:

chmod 400 /etc/ssh_host_ecdsa_key

Then I run the service:

net start sshd

It finally worked (BTW: I am using Windows 8)

Waddington answered 14/12, 2013 at 5:55 Comment(5)
Thank you for the answer. This works on Windows 8.1 as well. I will upvote the answer.Flask
chmod -v 600 /etc/ssh_*_key ; ls -altr /etc/ssh*key in my case, There were four. Something about the Polish version of Win 8.1 lead to rw perms globally for group, in Cygwin. CYGWIN=ntsecSpy
you said you followed the steps in this topic, that is not meaningful, can you elaborate, if not, you should have at the time.Boehmenist
Worked on windows 7 as well. Only thing that worked for me after trying everything for 6 hoursWhipping
This solved the problem in my case. I deleted all the keys and config files, and run ssh-host-config again.Wellstacked
E
16

I had the same problem and here is the solution that worked for me.

Solution 1

Restart the machine after you set the path environment variables to point to Cygwin bin directories and then start the service.

Solution 2

  1. First add the account that runs the Cygwin sshd demon service to administrators group (this is by default)

  2. Go to your cygwin installation folder (mine is at c:\cygwin64 and yours may differ)

    • add administrators group as full control. remove the property
    • Remove Readonly for your cygwin installation folder so anyone can write into it
  3. Run the cygwin terminal as administrator and remove the service by typing

    cygrunsrv -R sshd
    
  4. Reboot your system

  5. Run the cygwin terminal as administrator and reinstall the service again by typing

    ssh-host-config -y
    
  6. Run the cygwin terminal as administrator and start the service by typing

    net start sshd
    

Your service now be running!

Esp answered 8/12, 2013 at 11:58 Comment(1)
I am on Windows 10. I do not see administrators group in Properties > Security. I do not see "read only" option. I get an error on step 3 ``` $ cygrunsrv -R sshd cygrunsrv: Error removing a service: OpenService: Win32 error 1060: The specified service does not exist as an installed service. ```Brummett
M
5

I tried above solutions but nothing worked for me. I am using Windows 8 and was able to solve it. My sshd.log file says : "Privilege separation user sshd does not exist FAILED"

So to remove this error while starting sshd as service just following below steps:

  1. Edit the file /etc/passwd --
    add " sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin ".

  2. Edit the file /etc/group -- add " sshd:x:74: ".

Now start service as net start sshd

It worked for me!

Maverick answered 16/6, 2014 at 11:17 Comment(2)
Do you know why this works? How did you discover it?Thomasina
Editing (creating acutally) the passwd file worked for me to solve this problem for the sshd that came with (2.7.3) 64-bit version of Git for Windows. (After 15 years of using Cygwin I gave it up a few months ago in favor of the utilities that come with Git and I don't miss it at all) I did not have to edit/create a group file. The only additional thing I had to do was mkdir /var/emptyAppendage
P
2

Followed the steps provide by Andrea Solution 1 and solution 2 , it did not work. Event viewer did not provide any info.

So took a look at the log var/log/sshd.log first it complained that it was unable to load the dll:

/usr/sbin/sshd.exe: error while loading shared libraries: cygcrypto-1.0.0.dll

Solution:

  • Reinstalled the package and ensured that the dll were in lib.
  • Started the service again still it failed but this time it complained about missing host key.

    Could not load host key: /etc/ssh_host_dsa_key Could not load host key: /etc/ssh_host_ecdsa_key Disabling protocol version 2. Could not load host key sshd: no hostkeys available -- exiting.

Solution:

  • go to the Cygwin Command prompt (with run as admin ) and
  • enter ssh-keygen -A
    the missing host key were generated .

Finally I was able to start it.

I would recommend looking at the log file further if the above solution does not work.

Pournaras answered 19/12, 2013 at 2:31 Comment(1)
Yes!!! Definitely do take a look at var/log/sshd.log! My error was "Privilege separation user sshd does not exist" so I ran ssh-host-config again to enable the Privilege separation :)Evetta
S
0

In my case (using a Polish version of Windows 8) I had to manually modify the /etc/passwd and /etc/group files.

Some lines for Administrator, Administrators, Guest, Guests, etc. had been missing, so I merely inserted them, and copied all other fields from their non-English versions. Eg.

nano   /etc/passwd

SYSTEM:*:18:544:,S-1-5-18::
LocalService:*:19:544:U-NT AUTHORITY\LocalService,S-1-5-19::
NetworkService:*:20:544:U-NT AUTHORITY\NetworkService,S-1-5-20::
Administrators:*:544:544:,S-1-5-32-544::
Administratorzy:*:544:544:,S-1-5-32-544::
TrustedInstaller:*:4294967294:4294967294:U-NT SERVICE\TrustedInstaller,S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464::
Administrator:unused:500:513:U-gordito\Administrator,S-1-5-21-580982140-4090956935-1935414389-500:/home/Administrator:/bin/bash
Guest:unused:501:513:U-gordito\Gość,S-1-5-21-580982140-4090956935-1935414389-501:/home/Gość:/bin/bash
Gość:unused:501:513:U-gordito\Gość,S-1-5-21-580982140-4090956935-1935414389-501:/home/Gość:/bin/bash
HomeGroupUser$:unused:1004:513:HomeGroupUser$,U-gordito\HomeGroupUser$,S-1-5-21-580982140-4090956935-1935414389-1004:/home/HomeGroupUser$:/bin/bash
sshd:unused:1006:513:sshd privsep,U-gordito\sshd,S-1-5-21-580982140-4090956935-1935414389-1006:/var/empty:/bin/false
cyg_server:unused:1007:513:Privileged server,U-gordito\cyg_server,S-1-5-21-580982140-4090956935-1935414389-1007:/var/empty:/bin/false


nano /etc/group

root:S-1-5-32-544:0:
SYSTEM:S-1-5-18:18:
TrustedInstaller:S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464:4294967294:
Administrators:S-1-5-32-544:544:
Administratorzy:S-1-5-32-544:544:
Czytelnicy dzienników zdarzeń:S-1-5-32-573:573:
Guests:S-1-5-32-546:546:
Goście:S-1-5-32-546:546:
IIS_IUSRS:S-1-5-32-568:568:
Users:S-1-5-32-545:545:
Users DCOM:S-1-5-32-562:562:
Użytkownicy:S-1-5-32-545:545:
Użytkownicy DCOM:S-1-5-32-562:562:
Użytkownicy dzienników wydajności:S-1-5-32-559:559:
Użytkownicy monitora wydajności:S-1-5-32-558:558:
Użytkownicy zarządzania zdalnego:S-1-5-32-580:580:
HomeUsers:S-1-5-21-580982140-4090956935-1935414389-1003:1003:
TelnetClients:S-1-5-21-580982140-4090956935-1935414389-1005:1005:
WinRMRemoteWMIUsers__:S-1-5-21-580982140-4090956935-1935414389-1000:1000:
None:S-1-5-21-580982140-4090956935-1935414389-513:513:
Brak:S-1-5-21-580982140-4090956935-1935414389-513:513:

Only after this, I was finally able to chmod g-rwx all the files that offended sshd, in a way that 'ls -la' indeed confirmed the dropped permissions for group and other.

Then finally, privileged CYGWIN services installed and started (sshd, cron)

Spy answered 8/10, 2014 at 14:25 Comment(1)
I see this as a Cygwin installation bug, anyway. Above is a workaround....once someone finally becomes aware what is really going on.Spy

© 2022 - 2024 — McMap. All rights reserved.