# sudo ssh password reading from command line

**URL:** <https://forum.ansible.com/t/sudo-ssh-password-reading-from-command-line/13018>\
**Category:** Ansible Project\
**Created:** [June 26, 2013, 12:02am UTC](https://forum.ansible.com/t/sudo-ssh-password-reading-from-command-line/13018 "2013-06-26T00:02:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jean-marc\_pouchoulon](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jean-marc\_pouchoulon](https://forum.ansible.com/u/jean-marc_pouchoulon)\
**Post date:** [June 26, 2013, 12:02am UTC](https://forum.ansible.com/t/sudo-ssh-password-reading-from-command-line/13018/1 "2013-06-26T00:02:52Z")

</div>

Helo ansible list,

is there is a way to set sudo password from cli or variable in a playbook to permit batch mode without prompting?

thanks in advance

jean-marc

---

<div class="post-metadata">

**Author:** ![Timothy\_Gerla](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@Timothy\_Gerla](https://forum.ansible.com/u/Timothy_Gerla)\
**Post date:** [June 26, 2013, 12:13am UTC](https://forum.ansible.com/t/sudo-ssh-password-reading-from-command-line/13018/2 "2013-06-26T00:13:13Z")

</div>

Hi Jean-Marc,

There is not a way to do this. The suggested approach is to enable password-less sudo on your target machines instead of storing or saving the password on the Ansible machine.

Thanks,

Tim

---

<div class="post-metadata">

**Author:** ![Jim\_Richardson](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Jim\_Richardson](https://forum.ansible.com/u/Jim_Richardson)\
**Post date:** [June 26, 2013, 12:18am UTC](https://forum.ansible.com/t/sudo-ssh-password-reading-from-command-line/13018/3 "2013-06-26T00:18:07Z")

</div>

If you use -K (ask sudo passwd) it will hold the password in memory, and use it on each host as it is asked for pass. Assumes one user/pass for all the hosts being affected by that run of course.
