ansible 使用普通用户ssh免密登录提示无tmp权限

报错:

| UNREACHABLE! => {
"changed": false,
"msg": "Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /tmp/.ansible1/tmp `\"&& mkdir \"` echo /tmp/.ansible1/tmp/ansible-tmp-1677205288.53-125475-28367539157477 `\" && echo ansible-tmp-1677205288.53-125475-28367539157477=\"` echo /tmp/.ansible1/tmp/ansible-tmp-1677205288.53-125475-28367539157477 `\" ), exited with result 1",
"unreachable": true

 

 

今天测试ansible的普通用户免密登录一直提示无tmp权限,一开始以为是免密问题,仔细看过-vvv的日志之后,是正常连接的,就是无法创建/tmp/.ansible1目录下临时文件,按道理不应该的,以为tmp目录是谁都可以使用的,去客户端机器上看,发现这个目录的属主是root,才想起来前期是通过root的远程管理的,应该是当时创建的root属主的临时文件。删除该目录重新远程执行命令成功!

 

 

有问题目录权限:

 

posted @ 2023-02-24 10:30  忙碌在路上  阅读(780)  评论(0编辑  收藏  举报