在阿里云的ubuntu系统用xshell连接发现报错无法连接,百度了一圈好多方法不行,这里给出我最后解决的方法。
xshell报错提示:服务器发送了一个意外的数据包。received: 3,expected: 20
1.在服务器查看报错
首先在阿里云在浏览器登录阿里云,查看sshd状态
发现有有很多红色的报错,我就选择了第一条报错百度了下
命令:systemctl status sshd.service
报错:error: kex protocol error: type 30 seq 1 [preauth]
2.解决方法
命令: vim /etc/ssh/sshd_config
打开sshd_config并且将下面的复制进去保存,然后重启reboot即可。
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1
AI 代码解读
执行完此步骤后继续查看sshd状态 发现所有的报错完美解决。
参考:
https://blog.csdn.net/dingshangfu2977/article/details/101957061
https://blog.csdn.net/weixin_34357962/article/details/94498362