sshd is running as a service but cygwin and services.mmc thinks it's not

Igor Peshansky pechtcha@cs.nyu.edu
Fri Sep 8 03:17:00 GMT 2006


On Thu, 7 Sep 2006, Ron Dozier wrote:

> sshd has it's signals crossed.
>
> Summary:
>
> A program called active ports says sshd is running and windows and
> cygrunsrv -Q sshd says it's not.  Windows and cygwinsrv are both lying
> since I can log in.

The fact that you can log in says that sshd is running on the machine.
What both Windows and cygrunsrv are trying to tell you is that it's not
running *as a service* (meaning a Windows service).

> I can't stop the service, because windows and cygwin think it's not
> started.
>
> but I can stop sshd.exe with active ports "Terminate Process" button.
>
> The output from tasklist and Active Ports at boot with sshd installed as
> service are shown later.
> [snip]
>
> I was having problems with sshd not allowing logins until I issued a
> "net start sshd" command which proceeded abnormally, but allowed logins
> on a work computer.

That's because the sshd process wasn't running yet until you tried
starting a service.

> I took the issue to my Laptop and did what I'm supposed to do:
>
> I upgraded to the latest and greatest version of cygwin a few days ago.

Good.

> Service was installed using "cygrunsrv -I sshd -p /usr/sbin/sshd -y
> tcpip

Not good.  Is there a reason you didn't simply use ssh-host-config?
You're missing the crucial parameter to sshd (or, alternately, cygrunsrv),
which actually explains your behavior.

> Cygrunsrv is installed as a service. I can login to my laptop from a
> Unix host even when no user is logged in. (good)

By default, sshd runs in daemon mode, which means it forks off a daemon
process and then quits.  You either need to tell sshd to not fork off
another process, or tell cygrunsrv that the sshd process will quit, and to
use the alternate means of communicating Service Control Manager commands
to it.  I intentionally do not include the actual option values, since
this would have happened automatically for you had you used
ssh-host-config.  I suggest you remove the service and re-run
ssh-host-config.

> [snip]
> SO ACTIVE PORTS SAYS sshd IS RUNNING AND WINDOWS AN CYGWIN SAY IT'S NOT.
> WINDOWS AND CYGWINSRV ARE BOTH LYING SINCE I CAN LOG IN.

Shouting is not healthy. :-)  Besides, as explained above, Windows and
Cygwin don't claim that sshd is not running -- they only say that the
associated *service* is not in the running state...

> I CAN'T STOP THE SERVICE, BECAUSE WINDOWS AND CYGWIN THINK IT'S NOT
> STARTED.

...and thus you can't stop it.

> BUT I CAN STOP sshd with Active Ports.

You can kill the sshd process, which is not the same.  You could also have
done this via the Windows task manager running as the appropriate user, or
via the Cygwin "kill" command.  In either case, you're killing the
*process*, not the *service*.

> [snip]
> I'm very confused.  Both systems are Windows XP Pro and I haven't
> upgraded the one that doesn't start the service automatically before you
> are logged in.

If you have a working "control" machine, I suggest using "cygrunsrv
--verbose -Q" to compare the service program settings on the two machines.
That would have allowed you to quickly spot the difference.

If the above does not solve your problem, please read and follow the
Cygwin problem reporting guidelines at <http://cygwin.com/problems.html>,
especially the bit that talks about attaching (as an uncompressed text
attachment) the output of "cygcheck -svr" on the problem machine.
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