cygrunsrv, sshd, services and not starting after boot

Igor Peshansky pechtcha@cs.nyu.edu
Sat Sep 2 20:47:00 GMT 2006


On Sat, 2 Sep 2006, Ron Dozier wrote:

> I noted that a lot of people are having trouble getting the sshd service
> to start automatically.  I think I discovered a problem.
>
> Run services.msc and selecting sshd) there is a "Path to executable"
> field that currently says :"C:\cygwin\bin\cygrunsrv.exe"
>
> Based on looking at some other entries like "automatic updates which use
> C:\WINDOWS\system32\svchost.exe -k netsvcs", I believe it should say:
>
> C:\cygwin\bin\cygrunsrv.exe -S sshd
>
> otherwise the application cygrunsrv has no idea what service to start.

Actually, that's not true.  Cygrunsrv knows exactly which service to
start, since the service application can easily retrieve the name of the
service, the parameters, etc.  svchost is just lazy, I guess...

Also, "cygrunsrv -S" will not do what you want -- it will send the message
to the service control manager to start the service (which will attempt to
execute "cygrunsrv -S" again, causing an infinite loop).

> Microsoft says it's up to the developer to provide a mechanism to do so.
>
> "net start" sshd works.  Currently someone has to log in after a boot
> and type the command.

The fact that it works after boot but doesn't at boot indicates a missing
service dependency (so that the system attempts to start sshd before some
prerequisite is started, while after boot the prerequisite service is
already running).  The well-known prerequisites are the Tcp/ip service and
the various firewall services.  I'd try those.

> The suggestion of running a batch file containing
> "net start sshd" has been suggested to run automatically after a user
> logs in but was not tried.
>
> This would require a user logging in.

Most likely that will work too, but adding the dependency will cause the
service to start correctly the first time.

> Features of cygrunsrv I'd like to see:
> A method of changing the Path variable reported by services.msc.

Look at the "-e" option.

> A method of changing the options presented to sshd reported by
> services.msc.

Look at the "-a" option.

All of the information shown by "cygrunsrv --verbose -Q" is stored in
standard ways in the service specifications.  If services.msc does not
display that information, then this is a deficiency on the part of
services.msc.

> Am I barking up the wrong tree?

Most likely yes, sorry.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
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/



More information about the Cygwin mailing list