美文网首页
ssh免密码登陆设置时Authentication refuse

ssh免密码登陆设置时Authentication refuse

作者: 小疯伊始 | 来源:发表于2018-10-23 14:52 被阅读0次

问题

    设置ssh免密码登陆的时候,发现有一些机器设置不生效。有一些机器正常。

跟踪

    登陆目标机器,查看sshd的日志信息。日志信息目录为,/var/log/secure

    你会发现如下字样的日志信息。

    Jul 22 14:20:33 v138020.go sshd[4917]: Authentication refused: bad ownership or modes for directory /home/xinhailong

原因

    sshd为了安全,对属主的目录和文件权限有所要求。如果权限不对,则ssh的免密码登陆不生效。

    用户目录权限为 755 或者 700,就是不能是77x。

    .ssh目录权限一般为755或者700。

    rsa_id.pub 及authorized_keys权限一般为644

    rsa_id权限必须为600

解决方法

    检测目录权限,把不符合要求的按要求设置权限即可。

转自:https://www.bo56.com/ssh%E5%85%8D%E5%AF%86%E7%A0%81%E7%99%BB%E9%99%86%E8%AE%BE%E7%BD%AE%E6%97%B6authentication-refused-bad-ownership-or-modes%E9%94%99%E8%AF%AF%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/

相关文章

网友评论

      本文标题:ssh免密码登陆设置时Authentication refuse

      本文链接:https://www.haomeiwen.com/subject/znhazftx.html