Re: cannot start sshd on cygwin- win xp



Darren Dunham wrote:

jameshanley39@xxxxxxxxxxx <jameshanley39@xxxxxxxxxxx> wrote:
I rebooted the machine and it did not start.
On further tests based on the methods you have mentioned..

I have since reinstalled cygwin, this time with OpenSSL

I found that the strace command, started sshd and sort of occupied
the window, did not return me to a shell to enter more commands in
that window. Not a problem, I can open another cygwin window.

Let's start slow. Make sure the server works properly before trying
to turn it into a service.


I just tested, you are right, it does start as a server(whether it
works or not I don`t know). (though it doesn`t start or work as a
service yet)

/usr/sbin/sshd <-- starts sshd (shows in netstat)
I can kill it from cygwin or "end task" it from windows.


When run with no options (no '-d' right?) then it should return
control in your shell.


justing by a test I did. I think when one does
strace /usr/sbin/sshd -x

where x is any letter. It goes to sshd, not to strace, right?

regarding this command
$ strace /usr/sbin/sshd ...

if sshd is not running then
When I run that command with no options,
it still halts similar to -d.
It just halts at a different place.


When I run strace with -d it halts at

330 1341925 [main] sshd 468 select_stuff::wait: m 2, ms 4294967295

When I run it without -d, it halts at
881 2356886 [main] sshd 156 pinfo::exit: Calling ExitProcess n 0x0,
exitcode 0x0


When I say halt, i just mean doesn`t return me to the shell. The server
shows in netstat until sshd is killed.

if i run strace with a wrong switch or when sshd is already running,
then it prints a load of stuff, exits to a shell and does not start a
new sshd, it seems to do nothing. That is the only time strace exits to
a shell. (that, and when i kill sshd from another window)



Do you see information in your event viewer? When I run sshd I get a
nice message about sshd: PID XXX: Server listening on 0.0.0.0 port 22.

Anything different for you?



I do not see such a nice message.

In Event Viewer..Application
it says sshd . But when I double click it

Event Type: Information
Event Source: sshd
Event Category: None
Event ID: 0
Date: 11/2/2007
Time: 1:12:39 AM
User: MINITOUGH\Current user
Computer: MINITOUGH
Description:
The description for Event ID ( 0 ) in Source ( sshd ) cannot be found.
The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may
be able to use the /AUXSOURCE= flag to retrieve this description; see
Help and Support for details. The following information is part of the
event: sshd: PID 232: Received signal 15; terminating..


Also,
when I tried to look at the stuff that strace dumped. I saw errors




$ strace /usr/sbin/sshd -D >h


from the h file-----
166 31496 [main] sshd 2796 symlink_info::check: GetFileAttributes
(C:\cygwin
\home\Current user\some disk file) failed
111 31607 [main] sshd 2796 geterrno_from_win_error: windows error 2
== errno
2
152 31759 [main] sshd 2796 symlink_info::check: GetFileAttributes
(C:\cygwin
\home\Current user\some disk file.lnk) failed
111 31870 [main] sshd 2796 geterrno_from_win_error: windows error 2
== errno
2
-------------

I got very similar errors from doing the same thing with -d instead of
-D.

though with -d, ssh dumped some extra info on the screen, as well as
outputting all the other stuff to the h file.


How about when you try to run it as a service?


Current user@minitough ~
$ cygrunsrv -I sshd -p /usr/sbin/sshd

Current user@minitough ~
$ cygrunsrv -S sshd
cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error
1062:
The service has not been started.


It does install as service. It appears in the list of Services shown
by windows. If I run cygrunsrv -I ... when it is already installed I
get an error, but I can remove and install sshd as a service. From the
looks of things, in start..run..services.msc , it installs. Just does
not start.

Current user@minitough ~
$ net start sshd
The sshd service is starting.
The sshd service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

And what does thoat help message display?


Current user@minitough ~
$ net helpmsg 3534

The service did not report an error.


I'm not sure where I found this, but I think that the service runner
expects that the program it's running will stick around (in other
words, doesn't create a separate daemon). So I run my ssh with -D
when I'm invoking as a service, and without it when invoking from a
shell.

$ /usr/sbin/sshd
[pause..]
$

Works fine. Or....(after killing the one above)



how do I invoke it as a service using -D ?

$ cygrunsrv -I sshd -p /usr/sbin/sshd -D
cygrunsrv: unknown option -- D

Current user@minitough ~
$ cygrunsrv -I sshd -p /usr/sbin/sshd

Current user@minitough ~
$ cygrunsrv -S sshd -D
cygrunsrv: unknown option -- D



$ net start sshd
The CYGWIN sshd service is starting.
The CYGWIN sshd service was started successfully.

$ cygrunsrv -Q sshd
Service : sshd
Display name : CYGWIN sshd
Current state : Running
Controls Accepted : Stop
Command : /usr/sbin/sshd -D

I can`t start my sshd service.

though it does appear to run as a server.

many thanks.
.



Relevant Pages

  • I have problem with access.conf in openssh 3.8.1p1
    ... I compiled openssh 3.8.1p1 with PAM and configured: ... /etc/ssh/sshd_config: USEPAM yes ... When I checked issue with strace I noticed that sshd not jumped to ...
    (SSH)
  • I have problem with access.conf in openssh 3.8.1p1
    ... I compiled openssh 3.8.1p1 with PAM and configured: ... When I checked issue with strace I noticed that sshd not jumped to ...
    (comp.security.ssh)
  • Re: cannot start sshd on cygwin- win xp
    ... What about the 'sshd -d' and the strace? ... I`ll repeat here ... it looks like you hit a nerve with the strace ...
    (comp.security.ssh)
  • Re: native port of sshd for windows
    ... > Does a native port of SSHD (the server, ... You can run the cygwin sshd from a DOS/command shell line rather than ... I had it running on Windows ME by having a BAT file launch it ...
    (comp.security.ssh)
  • Re: Q:Two Cygwin sshds per one Windows machine?
    ... Both should have sshd server. ... >>has anybody managed to set up two Cygwin sshd processes for single ... I am thinking of setting ssh connections ... The SSH daemons will have to listen on different ports, ...
    (comp.security.ssh)