环境:Centos Stream release 9
情况:通过ssh方式,不管本地登录localhost还是远程登录,均失败。
尝试关闭firewalld和selinux,也不起作用。经搜索和尝试,需要修改/etc/ssh/sshd_config的PermitRootLogin的参数为yes。
这个和之前一篇root用户ssh登录Fedora报错的情况一致。
TIPS:
1、使用SecureCRT v7.1.0 ssh远程Centos9服务器时,提示如下:
查看SecureCRT的SSH2配置,可以看到v7.1.0版本支持的Key exchange比较少,无法支持服务器所需要的如: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
所以此时需要使用更高级版本的SecureCRT或者其他的较新版本SSH工具,且建议把所有支持的方法都勾上。
2、Centos Stream 8、9的阿里云yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
参考文档:
https://www.server-world.info/en/note?os=CentOS_Stream_9&p=ssh&f=1
https://forums.vandyke.com/showthread.php?p=44102
SecureCRT SSH 失败 Key exchange failed 解决方法_许之恒的博客-CSDN博客_key exchange failed.