# Synchronize via sudo -- no tty present and no askpass program specified

**URL:** <https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427>\
**Category:** Ansible Project\
**Created:** [October 3, 2015, 8:36pm UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427 "2015-10-03T20:36:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Leo\_Huetter](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Leo\_Huetter](https://forum.ansible.com/u/John_Leo_Huetter)\
**Post date:** [October 3, 2015, 8:36pm UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427/1 "2015-10-03T20:36:21Z")

</div>

Hello, I have seen many similar topics but want to make sure my issue is the same.

Our enterprise is taking a look at Ansible to handle non-root tasks. I am trying to use the synchronize module but having many issues getting it to work with sudo.

Assume no root access, and the maintenance user we can connect with has SUDO to other users.

Task:

- name:  
when: app\_user|default(None) != None  
become: yes  
become\_user: “{{ app\_user }}”  
become\_method: sudo  
synchronize: src=x dest=/app//{{ app\_user }}/testx

Fails with this error:

msg: sudo: no tty present and no askpass program specified  
rsync: connection unexpectedly closed (0 bytes received so far) [sender]  
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

Any ideas?

I have tried messing with the rsync\_path –

I dont want to mess around too much as I am afraid my sudo password I type in will end in plain text somewhere.

---

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [October 4, 2015, 4:22pm UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427/2 "2015-10-04T16:22:06Z")

</div>

Hello Johue,

I ended up turning sudo to NOPASS during the action and resetting it afterwards.

Regards  
Mirko

---

<div class="post-metadata">

**Author:** ![John\_Leo\_Huetter](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Leo\_Huetter](https://forum.ansible.com/u/John_Leo_Huetter)\
**Post date:** [October 5, 2015, 3:59pm UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427/3 "2015-10-05T15:59:55Z")

</div>

This will not work for us. We have to give the password as part of our security rules.

---

<div class="post-metadata">

**Author:** ![Guo\_Nosun](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Guo\_Nosun](https://forum.ansible.com/u/Guo_Nosun)\
**Post date:** [June 21, 2017, 7:18am UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427/4 "2017-06-21T07:18:08Z")

</div>

在 2015年10月5日星期一 UTC+8下午11:59:55，johhue写道：

---

<div class="post-metadata">

**Author:** ![Guo\_Nosun](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Guo\_Nosun](https://forum.ansible.com/u/Guo_Nosun)\
**Post date:** [June 21, 2017, 7:20am UTC](https://forum.ansible.com/t/synchronize-via-sudo-no-tty-present-and-no-askpass-program-specified/19427/5 "2017-06-21T07:20:18Z")

</div>

Any Ideas, I met the same issue
