解决Centos7无法登录Ubuntu24-RSA失效问题

178次阅读
没有评论

共计 555 个字符,预计需要花费 2 分钟才能阅读完成。

问题描述: 在 centos7 服务器上面无法 ssh root@ubuntu24 服务器。

ubuntu 服务器安全日志报错:

userauth_pubkey: signature algorithm ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

原因:

在 SSH 协议中,ssh-rsa 签名算法是 SHA1 的哈希算法和 RSA 公钥算法的结合使用。由于目前 SHA1 的哈希算法容易受到攻击,OpenSSH 从 8.7 以后版本开始默认不支持 ssh-rsa 签名方案。

第一种方法:使用 ed25519 算法生成 key

ssh-keygen -t ed25519
cat ~/.ssh/id_ed25519.pub

将新生成的公钥添加到 ubuntu 服务器上面就可以了

第二种方法 运行以下命令,在 sshd 配置中允许使用 ssh-rsa(rsa/SHA1)的签名算法

echo 'PubkeyAcceptedAlgorithms=+ssh-rsa' >> /etc/ssh/sshd_config
systemctl restart sshd

参考: https://help.aliyun.com/zh/ecs/user-guide/resolve-an-rsa-key-based-connection-failure-to-an-instance

正文完
 0
ddn
版权声明:本站原创文章,由 ddn 2024-07-18发表,共计555字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)