Can't connect to Openssh server: ssh_exchange_identification: read: Connection reset by peer

cedric B 1 Reputation point
2021-04-10T10:06:30.11+00:00

I have installed OpenSSH server and client on a windows 10 laptop. It wasn't working, so I unistalled and reinstalled both, then it was working fine. I could ssh into my windows machine from other machines on the same local network using windows username and password to authenticate.

Then, according to https://www.hanselman.com/blog/the-easy-way-how-to-ssh-into-bash-and-wsl2-on-windows-10-from-an-external-machine, I changed a registry key to change the default shell to bash.exe ( wsl2 is installed on my windows laptop )

So, I typed this in a powershell: New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force

and after that I could not ssh anymore to my windows laptop, getting this error message: PS C:\Users\cedric> ssh cedric@192.168.0.16 ssh_exchange_identification: read: Connection reset by peer

I've tried to change back the openssh shell registrey key like this and I still got the same error message: New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

I've also unistalled and reinstalled both Openssh client and server, restarted the laptop and I still get the error message when attempting a ssh connection to the windows laptop: ssh_exchange_identification: read: Connection reset by peer

Finally using verbose option, here is the detailed output: PS C:\Users\cedric> ssh cedric@192.168.0.16 -v OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 192.168.0.16 [192.168.0.16] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cedric/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
ssh_exchange_identification: read: Connection reset by peer

Is there anything I can do to make ssh server work again on windows 10 ? Thanks in advance for your help

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,735 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Fan Fan 15,346 Reputation points Microsoft Vendor
    2021-04-12T07:16:08.14+00:00

    Hi,
    Following case for your reference:
    https://askubuntu.com/questions/918667/how-to-fix-ssh-exchange-identification-read-connection-reset-by-peer-error
    Hope it will be useful.
    This response contains a third-party link. We provide this link for easy reference. Microsoft cannot guarantee the validity of any information and content in this link.

    Best Regards,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.