«ssh_exchange_identification: read: Connection reset by peer» ошибка при попытке подключиться к OpenSSH на компьютере Windows

Я пытаюсь настроить SSH-сервер на моем сервере Windows2k8. Я использовал инструкции, найденные здесь здесь . Вот подробный вывод:

steves-air:~ steve$ ssh steve@mydomain.ca -v
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to mydomain.ca port 22.
debug1: Connection established.
debug1: identity file /Users/steve/.ssh/id_rsa type -1
debug1: identity file /Users/steve/.ssh/id_rsa-cert type -1
debug1: identity file /Users/steve/.ssh/id_dsa type -1
debug1: identity file /Users/steve/.ssh/id_dsa-cert type -1
debug1: identity file /Users/steve/.ssh/id_ecdsa type -1
debug1: identity file /Users/steve/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/steve/.ssh/id_ed25519 type -1
debug1: identity file /Users/steve/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/steve/.ssh/id_xmss type -1
debug1: identity file /Users/steve/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
ssh_exchange_identification: read: Connection reset by peer

Пока я могу получить сетевое соединение,указывая, что это не проблема брандмауэра. В качестве теста я также попробовал запустить sshd под cygwin. Я смог получить подсказку терминала с этим. Я бы предпочел использовать OpenSSH, так как хочу, чтобы он работал с PowerShell.

Я попытался установить уровень ведения журнала на DEBUG, но не получаю оттуда никакой другой информации об устранении неполадок.

Буду признателен за любое руководство.

* edit: Только что понял, что я должен упомянуть. Я попытался поместить файл hosts.allow в каталог% programdata% / ssh. Это не помогло, и я не уверен, применимо ли это в данном случае.

* edit2: Я пробовал запустить sshd в интерактивном режиме в соответствии с шагами по устранению неполадок из здесь . Когда я пытался подключиться, в Windows происходил сбой приложения. Вот результат до сбоя:

PS C:\Program Files\OpenSSH> .\sshd.exe -d
debug1: sshd version OpenSSH_for_Windows_7.9, LibreSSL 2.6.5
debug1: private host key #0: ssh-rsa SHA256:XXX
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:XXX
debug1: private host key #2: ssh-ed25519 SHA256:XXX
debug1: rexec_argv[0]='C:\\Program Files\\OpenSSH\\sshd.exe'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Server will not fork when running in debugging mode.
Connection from 192.168.1.39 port 51410 on 192.168.1.3 port 22
debug1: Client protocol version 2.0; client software version 
OpenSSH_7.9
debug1: match: OpenSSH_7.9 pat OpenSSH* compat 0x04000000
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9
debug1: monitor_read_log: child log fd closed
debug1: do_cleanup
debug1: Killing privsep child 10684
0
задан 14 February 2019 в 16:37
3 ответа

Похоже, ответ - «отсюда вам не добраться». Я обнаружил закрытую проблему в git, в которой говорится, что стандарт w2k8 не поддерживается . Я попытался установить на другой сервер, на котором есть 2k8R2, и это сработало легко.

0
ответ дан 5 December 2019 в 04:07

FWIW, вы можете попробовать порт OpenSSH Cygwin. Если вы хотите просто проверить, работает ли он, вы можете попробовать следующее:

https://github.com/Bill-Stewart/Cygwin-OpenSSH

Для этого действительно требуется Windows PowerShell v2 в Vista / Server 2008. , хотя, поэтому вам нужно будет сначала установить его (что, надеюсь, вы уже должны были установить).

0
ответ дан 5 December 2019 в 04:07

Если ничего не работает, проверьте это.

Я смог найти корень вызвать с помощью systemctl status sshd .

В моем /etc/hosts.deny не было новой строки в конце.

➜  ~ cat /etc/hosts.deny       
# /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
#                  See the manual pages hosts_access(5) and hosts_options(5).
#
# Example:    ALL: some.host.name, .some.domain
#             ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID%                                                                                                                                                                                                     ➜  ~ 
➜  ~ ssh localhost             
ssh_exchange_identification: read: Connection reset by peer
➜  ~ 
➜  ~ sudo systemctl status sshd 
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-10-14 16:45:43 IST; 20s ago
  Process: 11488 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 11494 (sshd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ssh.service
           └─11494 /usr/sbin/sshd -D

Oct 14 16:45:43 mani-8681 systemd[1]: Starting OpenBSD Secure Shell server...
Oct 14 16:45:43 mani-8681 sshd[11494]: Server listening on 0.0.0.0 port 22.
Oct 14 16:45:43 mani-8681 sshd[11494]: Server listening on :: port 22.
Oct 14 16:45:43 mani-8681 systemd[1]: Started OpenBSD Secure Shell server.
Oct 14 16:45:54 mani-8681 sshd[11555]: warning: /etc/hosts.deny, line 15: missing newline or line too long
Oct 14 16:45:54 mani-8681 sshd[11555]: warning: /etc/hosts.deny, line 15: all the subsequent rules will be ignored
Oct 14 16:45:54 mani-8681 sshd[11555]: refused connect from 127.0.0.1 (127.0.0.1)

Добавление новой строки в конце исправлено проблема.

➜  ~ cat /etc/hosts.deny
# /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
#                  See the manual pages hosts_access(5) and hosts_options(5).
#
# Example:    ALL: some.host.name, .some.domain
#             ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID
➜  ~ ssh localhost date
Password:
Mon Oct 14 16:51:56 IST 2019
0
ответ дан 5 December 2019 в 04:07

Теги

Похожие вопросы