首页 > 其他分享 >Authentication refused: bad ownership or modes for directory /root

Authentication refused: bad ownership or modes for directory /root

时间:2023-03-24 18:34:48浏览次数:40  
标签:私钥 modes 700 chmod refused bad ssh root 600

问题描述

在jekins添加publish over ssh远程主机,通过指定私钥连接远程主机,始终连接不上,报授权失败,登陆jenkins主机,使用ssh -i指定私钥连接也是连接不上,报以下错误:

error: Received disconnect from 10.10.10.200 port 51130:3: com.jcraft.jsch.JSchException: Auth fail [preauth]
Authentication refused: bad ownership or modes for directory /root

解决办法

1、修改jenkins主机私钥权限为600

chmod 600 /var/jenkins_home/.ssh/pem/id_rsa

2、修改ssh客户端~/.ssh目录权限为700或755

chmod 700 .ssh
chmod 755 ~/.ssh

3、修改authorized_keys权限

chmod 644  /root/.ssh/authorized_keys或
chmod 600  /root/.ssh/authorized_keys

以上方法仍然无法访问,最后的解决办法是修改/root目录权限

4、chmod 700 /root

755都不行,得700才可以,这里不知道为什么,有待后续研究。

标签:私钥,modes,700,chmod,refused,bad,ssh,root,600
From: https://blog.51cto.com/riverxyz/6147640

相关文章