1. kex_exchange_identification
kex_exchange_identification: read: Connection reset by xxx.xx.xx.x
一直连不上实验室的服务器,用PUTTY和Mobaxterm也不行(报错:Remote side unexpectedly closed network connection)。已知我的公钥已经添加到了服务器,我的电脑用的WIN11也自带openssh服务,我的IP也没有被禁掉,所以搜的各种方法都不适用,只能自己找问题
尝试:查看连接问题日志:用命令:ssh -v user@xxx.xx.xxx.xx
参考:解决ssh_exchange_identification:read connection reset by peer 原因_ssh_格格巫 MMQ!!-华为云开发者联盟 (csdn.net)
C:\Users\xx>ssh -v root@xxx.xx.xxx.xx
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Reading configuration data /.ssh/config
debug1: /.ssh/config line 1: Applying options for xxx.xx.xxx.xx
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to xxx.xx.xxx.xx [xxx.xx.xxx.xx] port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type 0
debug1: identity file /.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
看起来问题出在debug1: identity file /.ssh/id_rsa-cert type -1 这里,表示未找到对应的身份验证证书文件。这可能是导致连接问题的原因之一。在SSH身份验证过程中,通常需要配对的私钥和公钥证书文件。如果缺少身份验证证书文件,可能会导致连接失败或连接不稳定。
尝试手动生成证书:
下载openssl:windows安装OpenSSL - 丁少华 - 博客园 (cnblogs.com)
服务器方面的问题:【解决vscode连ssh问题:kex_exchange_identification: read: Connection reset】ssh无法重启-CSDN博客
2. Failed to set up dynamic port forwarding connection overSSH to the Vs Code Server
动不动就掉线重连,非常不稳定。打开GIT,尝试ping,超时,可以确定是自己这边的问题。
解决方法:【工程调试记录】vscode远程连接卡顿、频繁掉线的一个解决方法_将git安装路径下的*\git\usr\bin路径添加到系统自带openssh路径-CSDN博客
原因:本地使用的是win系统自带的openSSH,可能和vscode不太兼容。更换为git自带的ssh版本。注意改完系统变量后重启生效~(感谢)