ubuntu22.04使用secureCRT连接报错的问题
背景:
用的SecureCRT版本时6.5,系统版本是ubuntu22.04,在添加会话进行连接的时候报错:
Key exchange failed. No compatible key exchange method. The server supports these methods: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,kex-strict-s-v00@openssh.com
No compatible hostkey. The server supports these methods: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
Key exchange failed. No compatible hostkey. The server supports these methods: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
这个问题可能是软件版本问题:
两种解决方法:
第一种: 升级SecureCRT为最新版,或者使用其他连接工具 【使用finalshell是可以的,但是个人还是习惯secureCRT】
第二种: 修改服务器,使其兼容老系统的算法
既然报错说密钥交换失败。没有兼容的密钥交换方法。那就来添加交换密钥的方法
登录服务器后,在服务器里使用下面命令
vim /etc/ssh/sshd_config
在行尾加入以下内容
HostKeyAlgorithms=+ssh-rsa,ssh-dss KexAlgorithms=+diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
然后重启ssh
systemctl restart ssh