Subject: Re: sshd problems
From: "John R Larsen" <[email-masked]>
To: giuseppe <[email-masked]>
Cc: [email-masked]
Date: Tue, 05 Apr 2005 07:24:37 -0400

The service isn't running properly.  That's why you can't connect.  Look in /var/log/sshd.log to 
see what error messages may be there.  Next, use Windows task manager to kill the cygrunsrv 
process and the sshd process.  Use this command to verify that the process is stopped:

cygrunsrv -Q sshd

You should get this response:

Service sshd exists
Type                : Own Process
Current State       : Stopped
Controls Accepted   :

Try starting it up again with this command:

cygrunsrv -S sshd

If you get that windows error message again look in /var/log/sshd.log to see if new error 
messages have been entered.  That should give you a clue as to what might be wrong.  I've 
had entries like this before:

     Could not load host key: /etc/ssh_host_key
     Could not load host key: /etc/ssh_host_rsa_key
     Could not load host key: /etc/ssh_host_dsa_key
     Disabling protocol version 1. Could not load host key
     Disabling protocol version 2. Could not load host key
     sshd: no hostkeys available -- exiting.
Things that I've tried when trouble shooting this type of problem:

Make sure the permissions and ownership of the files in question are these:

-rw-------   1 SYSTEM        None     668 Mar 26 10:54 ssh_host_dsa_key
-rw-r--r--   1 SYSTEM        None     613 Mar 26 10:54 ssh_host_dsa_key.pub
-rw-------   1 SYSTEM        None     538 Mar 26 10:54 ssh_host_key
-rw-r--r--   1 SYSTEM        None     342 Mar 26 10:54 ssh_host_key.pub
-rw-------   1 SYSTEM        None     887 Mar 26 10:54 ssh_host_rsa_key
-rw-r--r--   1 SYSTEM        None     233 Mar 26 10:54 ssh_host_rsa_key.pub

If SYSTEM doesn't own the files and if the permissions are too open, sshd won't startup.

Another directory that must have correct ownership and permissions is /var/empty.  It should 
look like this:

drwxr-xr-x+ 2 SYSTEM        root     0 Mar 26 10:54 empty/

I've even had trouble if ownership of /var/log/sshd.log is incorrect.  You can simply move that 
file and let a new one be created to get around that problem.

The important thing I've encountered in my struggles with this is to start fresh.  Make sure the 
cygrunsrv and sshd processes are really killed by using the windows task manager.  Verify that 
with "cygrunsrv -Q sshd" and make sure it says the process is stopped.  Then start it up with 
"cygrunsrv -S sshd".  Check /var/log/sshd.log to see any error messages.

Good luck!

John

BTW.  I updated my work machine yesterday to the latest "CYGWIN_NT-5.0 1.5.14(0.126/4/2) 
2005-04-01 13:40" and had no trouble.  I made sure to start fresh though.  I don't know if it is 
required or not, but before updating I set the "sshd" service to "manual" and rebooted to be 
sure the cygwin dll wasn't loaded.  I renamed my c:\cygwin directory to c:\cygwin.hide to keep it 
around in case I needed to quickly switch back.  Then I did a fresh install using setup.exe.  I 
copied files from my old cygin /etc directory (ie. passwd, group, /email, /ssmtp).  Then to be 
safe I removed the service using "cygrunsrv -R sshd".  I then executed the /bin/ssh-host-config 
file and went through its steps.  I then started the service with "cygrunsrv -S sshd" and 
everything was fine.  Of course this generated new keys.  You could overwrite the new keys 
with the old ones so that your machine still has the same fingerprint when connecting, but I 
didn't bother with that.

On 5 Apr 2005 at 8:29, giuseppe wrote:

To:             	[email-masked]
From:           	giuseppe <[email-masked]>
Subject:        	Re: sshd problems
Date sent:      	Tue, 5 Apr 2005 08:29:04 +0000 (UTC)

[ Double-click this line for list subscription options ] 

> After you ran the ssh-host-config script, did you start the service with:
> 
> cygrunsrv -S sshd
> 
> If not, the service isn't running yet and you won't be able to connect.

thanks for answering,
well I tryed and that's the answer:

$  cygrunsrv -S sshd
cygrunsrv: Error starting a service: QueryServiceStatus: win32 error 1053

if i try to stop the service i get

$  cygrunsrv -S sshd
cygrunsrv: Error stopping a service: QueryServiceStatus: win32 error 1053

if  i try to start again the error number changes from 1053 to 1062

$  cygrunsrv -S sshd
cygrunsrv: Error starting a service: QueryServiceStatus: win32 error 1062

I remind that I installed the last( 1 week ago) version of cygwin on a machine
running windows xp professional with service pack 2. I simply installed cygwin
with the setup utility and confidurate ssh using ssh-host-config answering
always yes. Nothing else has been done.

regards 
giuseppe

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
_______________________________________________________
John R Larsen <[email-masked]>
http://larsen-family.us

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/