Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

Openssh-v8.9.1.0 Qin64 - client_loop: send disconnect: Connection reset

Open abhikt48 opened this issue 2 years ago • 6 comments

I need to connect openssh server with public-private key authentication. Connection is working fine with username-password but it is not working with public-private key authentication.

Server is throwing client_loop: send disconnect: Connection reset error while connecting through public-private key authentication, but it is not throwing any error with username-password.

I am new to this area. It will be much helpful if anyone can provide me any clue on this issue.

Please find below debug log details of ssh -v localhost command

Authentication with public-private key

PS C:\WINDOWS\system32> ssh -v localhost
OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Username/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\Username/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519_sk type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\Username/.ssh/id_xmss-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\Username/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.9
debug1: compat_banner: match: OpenSSH_for_Windows_8.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'domain-name\\Username'
debug1: load_hostkeys: fopen C:\\Users\\Username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:***/9SJT/tRtzo
debug1: load_hostkeys: fopen C:\\Users\\Username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'localhost' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\Username/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_rsa RSA SHA256:***/pJlFQ/8rmt/***/***
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_xmss
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected]=<0>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\Username/.ssh/id_rsa RSA SHA256:***/pJlFQ/8rmt/***/***
debug1: Server accepts key: C:\\Users\\Username/.ssh/id_rsa RSA SHA256:***/pJlFQ/8rmt/***/***
Enter passphrase for key 'C:\Users\Username/.ssh/id_rsa':
Authenticated to localhost ([::1]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
client_loop: send disconnect: Connection reset
PS C:\WINDOWS\system32>

Authentication with username-password key

PS C:\WINDOWS\system32> ssh -v localhost
OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Username/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\Username/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519_sk type -1
debug1: identity file C:\\Users\\Username/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\Username/.ssh/id_xmss-cert type -1
debug1: identity file C:\\Users\\Username/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\Username/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.9
debug1: compat_banner: match: OpenSSH_for_Windows_8.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'domain-name\\Username'
debug1: load_hostkeys: fopen C:\\Users\\Username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:kjDjwV5y3wmvwwUFwcBVDgAWHfHQxShW/9SJT/tRtzo
debug1: load_hostkeys: fopen C:\\Users\\Username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'localhost' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\Username/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_xmss
debug1: Will attempt key: C:\\Users\\Username/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected]=<0>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\Username/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\Username/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Username/.ssh/id_ecdsa_sk
debug1: Trying private key: C:\\Users\\Username/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\Username/.ssh/id_ed25519_sk
debug1: Trying private key: C:\\Users\\Username/.ssh/id_xmss
debug1: Trying private key: C:\\Users\\Username/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
domain-name\Username@localhost's password:
Authenticated to localhost ([::1]:22) using "password".
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_hostkeys: searching C:\\Users\\Username/.ssh/known_hosts for localhost / (none)
debug1: client_input_hostkeys: searching C:\\Users\\Username/.ssh/known_hosts2 for localhost / (none)
debug1: client_input_hostkeys: hostkeys file C:\\Users\\Username/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: host key found matching a different name/address, skipping UserKnownHostsFile update
Microsoft Windows [Version 10.0.19043.1706]
(c) Microsoft Corporation. All rights reserved.

domain-name\Username@ASGL-WL-18025 C:\Users\Username>

"OpenSSH for Windows" version 8.9.1.0

Server OperatingSystem Windows 10 Pro

Client OperatingSystem Windows 10 Pro

What is failing Fail to connect openssh server - client_loop: send disconnect: Connection reset

Expected output Connection should be successful.

Actual output client_loop: send disconnect: Connection reset

abhikt48 avatar Jun 23 '22 18:06 abhikt48

Can you provide the sshd logs as well? Steps for running sshd in debug are here

tgauth avatar Jun 24 '22 19:06 tgauth

I am experiencing the same issue

klo10 avatar Jul 14 '22 02:07 klo10

Here is. my ssh logs.

4276 2022-06-09 18:47:17.047 Server listening on :: port 22. 4276 2022-06-09 18:47:17.047 Server listening on 0.0.0.0 port 22. 4876 2022-06-09 18:47:25.843 Connection from 123.123.123.123 port 53113 on 10.0.0.3 port 22 4876 2022-06-09 18:47:29.468 Accepted key RSA SHA256:XXXXXXXXXXXX/XXXXXXXXXXXX found at C:/.ssh/authorized_keys:1 4876 2022-06-09 18:47:29.468 Accepted publickey for as_test from 789.789.789.789 port 53113 ssh2: RSA SHA256:XXXXXXXXXXXX/XXXXXXXXXXXX 4876 2022-06-09 18:47:29.515 User child is on pid 3664 4876 2022-06-09 18:47:29.531 Changed root directory to "C:/sftp" 4876 2022-06-09 18:47:30.390 Starting session: forced-command (config) 'internal-sftp' for as_test from 789.789.789.789 port 53113 id 0 4876 2022-06-09 18:47:30.734 Close session: user as_test from 789.789.789.789 port 53113 id 0 4876 2022-06-09 18:47:30.734 Received disconnect from 789.789.789.789 port 53113:11: disconnected by user 4876 2022-06-09 18:47:30.734 Disconnected from 789.789.789.789 port 53113

After connecting with RSA key, it just automatically disconnects.

klo10 avatar Jul 14 '22 02:07 klo10

I am facing the same issue, is there a resolution to this?

dearsrini22 avatar Nov 16 '23 22:11 dearsrini22

I am facing the same issue

abdullah1116 avatar Jan 04 '24 22:01 abdullah1116