Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password

Centos7.5 执行ansible命令报错

问题:

[root@m01 ~]# ansible servers -a "hostname" -i ./hosts -u root
172.16.1.7 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
"unreachable": true
}
172.16.1.8 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
"unreachable": true
}

原因:

之前测试的时候把家目录的权限给改了

解决方法:

把被控制端的密钥权限改成600
[root@web01 ~]# chmod -R 600 .
[root@m01 ~]# ansible servers -a "hostname" -i ./hosts
172.16.1.7 | CHANGED | rc=0 >>
web01
上一篇:centos下 kerberos安装手册


下一篇:屠龙之路_战胜View&对DataBase猛烈进攻_ThirdDay