# Ansible - ssh connect failure - tries to create a temp file on remote machine

**URL:** <https://forum.ansible.com/t/ansible-ssh-connect-failure-tries-to-create-a-temp-file-on-remote-machine/23890>\
**Category:** Ansible Project\
**Created:** [March 6, 2017, 10:17am UTC](https://forum.ansible.com/t/ansible-ssh-connect-failure-tries-to-create-a-temp-file-on-remote-machine/23890 "2017-03-06T10:17:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nidhi\_mittal\_hada](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nidhi\_mittal\_hada](https://forum.ansible.com/u/nidhi_mittal_hada)\
**Post date:** [March 6, 2017, 10:17am UTC](https://forum.ansible.com/t/ansible-ssh-connect-failure-tries-to-create-a-temp-file-on-remote-machine/23890/1 "2017-03-06T10:17:29Z")

</div>

hello

I am able to ssh from cli

[root@greglinux2 ~]# ssh [admin@10.64.32.160](mailto:admin@10.64.32.160)  
Password:

without any problem

# this is my inventory file.

[root@greglinux2 ~]# cat /etc/ansible/hosts  
10.64.32.160 ansible\_ssh\_pass=admin ansible\_ssh\_user=admin

# when i use ansible to just ping the same remote machine

[root@greglinux2 ~]# ansible -vvvvv all -m ping  
Using /etc/ansible/ansible.cfg as config file  
Loaded callback minimal of type stdout, v2.0  
\<10.64.32.160\> ESTABLISH SSH CONNECTION FOR USER: admin  
\<10.64.32.160\> SSH: ansible.cfg set ssh\_args: (-o)(ControlMaster=auto)(-o)(ControlPersist=60s)  
\<10.64.32.160\> SSH: ANSIBLE\_REMOTE\_USER/remote\_user/ansible\_user/user/-u set: (-o)(User=admin)  
\<10.64.32.160\> SSH: ANSIBLE\_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)  
\<10.64.32.160\> SSH: PlayContext set ssh\_common\_args: ()  
\<10.64.32.160\> SSH: PlayContext set ssh\_extra\_args: ()  
\<10.64.32.160\> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r)  
\<10.64.32.160\> SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.64.32.160 ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “`echo /home/admin/ansible-tmp-1487326446.12-124821749058426`” && echo ansible-tmp-1487326446.12-124821749058426=“`echo /home/admin/ansible-tmp-1487326446.12-124821749058426`” ) && sleep 0’“'”‘’  
10.64.32.160 | UNREACHABLE! =\> {  
“changed”: false,

# “msg”: “Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in “/tmp”. Failed command was: ( umask 77 && mkdir -p “`echo /home/admin/ansible-tmp-1487326446.12-124821749058426`” && echo ansible-tmp-1487326446.12-124821749058426=“`echo /home/admin/ansible-tmp-1487326446.12-124821749058426`” ), exited with result 1”,

“unreachable”: true  
}

I do not have permission to create a file in remote machine on any of the directory.

Is it necessary for ansible to have permission to create a file on remote machine directory ???

how do i bypass this problem ??

can someone please help ??

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 6, 2017, 5:43pm UTC](https://forum.ansible.com/t/ansible-ssh-connect-failure-tries-to-create-a-temp-file-on-remote-machine/23890/2 "2017-03-06T17:43:19Z")

</div>

Ansible doesn't run commands directly through SSH, it uploads a file  
that gets executed using python.  
So if you don't have permissions to create a file anywhere on the  
target system, it's not going to work.

But are you sure you don't have permission at all on the system?  
Did you try the recommended workaround that is in the output (Consider  
changing the remote temp path in ansible.cfg to a path rooted in  
"/tmp".)?

Dick
