使用 SecureCRT6.5连接新安装的ubuntu24.04时提示No compatible hostkey
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
1、修改配置文件
vim /etc/ssh/sshd_config
在 /etc/ssh/sshd_config 文件中追加以下两行文本
HostKeyAlgorithms ssh-dss,ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512 KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
2、重启ssh服务
systemctl restart ssh or systemctl restart sshd or systemctl restart ssh.service
3、在SecureCRT客户端重试
ssh 允许密码登录
vim /etc/ssh/sshd_config PasswordAuthentication yes PermitRootLogin yes
参考:
https://zhuanlan.zhihu.com/p/692807523
https://www.bmabk.com/index.php/post/240604.html