Ubuntu SSH私钥登录提示“Server refused our key”的排查思路

先查看公钥文件authorized_keys的权限是否为600,即-rw-------

如果authorized_keys权限确认正常,可以查看ssh认证日志tail -f /var/log/auth.log,看到日志有以下错误

Apr 26 19:58:34 hostname sshd[1929]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr 26 19:58:34 hostname sshd[1929]: Authentication refused: bad ownership or modes for directory /root

提示root目录owner不正确,使用chown -R root:root /root重新设置owner,问题解决