添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

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,