ssh key登陆遇到Could not open authorized keys ‘ .ssh/authorized_keys’: Permission denied

/ 5评 / 0

为新入的BLOG服务器配置SSH-KEY登陆时,遇到了前所未有的障碍。

RSA公钥和往常一样添加进了 .ssh/authorized_keys,这个动作少说做过50次,不会出错。但是putty登陆时一直显示key refused by server。

打开sshd的debug,在/var/log/secure里找到了错误信息为:

Could not open authorized keys ' .ssh/authorized_keys': Permission denied

检查权限

ls -l .ssh/authorized_keys

发现也没有错,确实是400权限。

根据stackoverflow

If the permissions are correct, SELinux might still be preventing sshd from opening the file.
Try fixing the labels inside the .ssh directory (and maybe $HOME):

restorecon -FRvv ~/.ssh

(I'm intentionally not suggesting disabling SELinux or setting it to the permissive mode.)

尝试此命令,问题解决。

5 responses to “ssh key登陆遇到Could not open authorized keys ‘ .ssh/authorized_keys’: Permission denied”

  1. Sq.do says:

    新后台上次瞄过一眼是Fedora系统,可能帮之前VPS静默策略不大一样

Leave a Reply

Your email address will not be published.