ssh连接远程服务器错误的原因之一

发布于 2025-02-16  242 次阅读



authorized_keys 不生效

其中一个原因是因为
我使用

cat /var/log/auth.log | grep sshd

查看目录的时候,发现

userauth_pubkey: signature algorithm ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
说明你的服务器 不支持 ssh-rsa 签名算法,这是由于 OpenSSH 8.8+ 默认禁用了 ssh-rsa 算法。
解决方法:在服务器的 sshd_config 里启用 ssh-rsa,或者换用更安全的密钥算法(如 ed25519 或 ecdsa)。

解决办法

sudo vi /etc/ssh/sshd_config
# 添加以下命令
PubkeyAcceptedAlgorithms +ssh-rsa
HostKeyAlgorithms +ssh-rsa

#重启服务
sudo systemctl restart ssh


注错之当