今天遇到一个问题,Jenkins构建失败,查看问题是SSH拷贝时失败,经过一步步排查,错误为:
#1、先查看ssh日志:
[root@Miwanzo ~]# tail -f /var/log/secure
#2、根据报错信息定位问题,由于权限问题,更改目录权限
Oct 9 16:05:15 jingshuo-dev sshd[3835]: Authentication refused: bad ownership or modes for directory /root
Oct 9 16:05:16 jingshuo-dev sshd[3835]: Connection closed by authenticating user root 172.17.232.24 port 45148 [preauth]
Oct 9 16:07:47 jingshuo-dev sshd[3857]: Authentication refused: bad ownership or modes for directory /root
Oct 9 16:08:44 jingshuo-dev sshd[3857]: Connection closed by authenticating user root 172.17.232.24 port 45198 [preauth]
Oct 9 16:08:50 jingshuo-dev sshd[3860]: Connection closed by authenticating user root 172.17.232.24 port 45218 [preauth]
[root@Miwanzo ~]# chmod 0750 /root -R
[root@Miwanzo ~]# chmod 600 /root/.ssh/id_ras
[root@Miwanzo ~]# systemctl restart sshd
#然后重新copy一下
[root@Miwanzo-master ~]# ssh-copy-id -i root@172.17.232.35