Linux系统上传公钥不生效问题
Authentication refused: bad ownership or modes for file /home/yanbo.xu/.ssh/authorized_keys
原因:
1、sshd为了安全,对属主的目录和文件权限有所要求。如果权限不对,则ssh的免密码登陆不生效。
.ssh目录权限为700 authorized_keys文件权限为600 id_rsa私钥文件权限为600 id_rsa.pub公钥文件权限为644 known_hosts文件权限为644
2、另一个不生效的原因就是/etc/ssh/sshd_config配置文件有问题
PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
要允许使用key认证。并且需要重启sshd服务。