I run an Openssh sshd service from Cygwin. When an RSA connection is established:
$ ssh Administrator@ZETA
Last login: Wed May 11 13:58:50 2016 from 10.1.1.140
-- there is no error message.
However, when I use an inline command:
$ ssh Administrator@ZETA "echo hi"
hi
-- the command works, but on ZETA the Windows Event Log now says:
sshd: PID 7068: error: get_socket_address: getnameinfo 2 failed: Unknown error
Calling this often fills the Event Log with errors.
Starting sshd on command line in debug mode:
/usr/sbin/sshd -ddd
-- produces no error. It also runs under different user and I had to chown administrator /var/empty
for it to work.
Trying to start sshd in debug mode as Windows service, as recommended in https://cygwin.com/ml/cygwin/2014-03/msg00488.html fails:
$ /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd_debug" -p /usr/sbin/sshd -a "-D -d -d -d" -y tcpip
/usr/bin/cygrunsrv: Error installing a service: OpenService: Win32 error 1073: The specified service already exists.
To resolve your cygrunsrv error while installing an
sshd_debug
service, you also have to change the<service_name>
and not only the<service display name>
in:where
<service_name>
is the windows internal service name<service display name>
is the name displayed inservices.msc
listOR you have to stop and remove the already defined service
sshd
first, before trying to define it again using debug parameters.Note: The commands below have to be entered in a shell with admin privileges. When sshd is run in debug mode with
-d
,-dd
or-ddd
, the server will not fork and will only process one connection and then stop.To define a second
sshd_debug
service:To install a second service named
sshd_debug
:Note that a particular
<service_name>
or<service display name>
cannot be defined more than once, otherwise an error will thrown bycygrunsrv
.Before you start your new
sshd_debug
service, the normalsshd
service has to be stopped:Now start the
sshd_debug
service:To redefine with the existing
sshd
service_name:Another example which will make the
cygrunsrv
command from your question work (using the service name:sshd
):To install a service under a specific account
Error:
get_socket_address: getnameinfo 2 failed
The function
get_socket_address
throwing the error message is defined incanohost.c
:It calls a function
getnameinfo
with flagNI_NUMERICHOST
, which should return a string with the human readable IP address of either the (remote) peer_ipaddr or the local_ipaddr. However, the function fails with an unknownEAI_SYSTEM
error (A system error occurred
).So this does not help a lot, but it might indicate that the error has to do with DNS name resolution.
To troubleshoot you could check if the name resolution is working:
reverse dns lookup
should return the fqdnforward dns lookup
should return the IP address