# Failed to copy directory to host

**URL:** <https://forum.ansible.com/t/failed-to-copy-directory-to-host/24018>\
**Category:** Ansible Project\
**Created:** [March 20, 2017, 8:02pm UTC](https://forum.ansible.com/t/failed-to-copy-directory-to-host/24018 "2017-03-20T20:02:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jian\_Gao](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@Jian\_Gao](https://forum.ansible.com/u/Jian_Gao)\
**Post date:** [March 20, 2017, 8:02pm UTC](https://forum.ansible.com/t/failed-to-copy-directory-to-host/24018/1 "2017-03-20T20:02:54Z")

</div>

I am new to Ansible. I installed Anasible 2.2.1.0 and start to learn playbook.

Anyway now I am having a issue to copy a directory to the target host. I tried “copy” and “synchronize” without success.

Here is the playbook:

`

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 21, 2017, 9:36am UTC](https://forum.ansible.com/t/failed-to-copy-directory-to-host/24018/2 "2017-03-21T09:36:38Z")

</div>

Looking at the command being run

cmd": “/usr/bin/rsync --delay-updates -F --compress --links --rsh ‘ssh -S none -o StrictHostKeyChecking=no’ --rsync-path="sudo rsync" --out-format=‘\<\>%i %n%L’ "/etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/" "sysadmin@192.168.123.150:/usr/local/lib/"”,

and the error message

“msg”: “sudo: no tty present and no askpass program specified\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]\n”,

It looks like you are a/ trying to use ‘sudo’ and b/ that sudo isn’t getting a password.

I’m guessing that you haven’t met all the conditions for using ‘become’ yet.

Have a read of [http://docs.ansible.com/ansible/become.html](http://docs.ansible.com/ansible/become.html)

You might just need to specify the user you want to sudo as and the password for the sudo user.

Hope this helps,

Jon
