# sg": "ERROR! ssh connection closed waiting for password prompt", Error

**URL:** <https://forum.ansible.com/t/sg-error-ssh-connection-closed-waiting-for-password-prompt-error/18740>\
**Category:** Ansible Project\
**Created:** [July 13, 2015, 6:43am UTC](https://forum.ansible.com/t/sg-error-ssh-connection-closed-waiting-for-password-prompt-error/18740 "2015-07-13T06:43:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_Suryagandh](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@Gaurav\_Suryagandh](https://forum.ansible.com/u/Gaurav_Suryagandh)\
**Post date:** [July 13, 2015, 6:43am UTC](https://forum.ansible.com/t/sg-error-ssh-connection-closed-waiting-for-password-prompt-error/18740/1 "2015-07-13T06:43:31Z")

</div>

Hello All,

I am trying to use script module of ansible to execute my local script on the remote machine but i am facing below error.

sg": “ERROR! ssh connection closed waiting for password prompt”,

Below is debug trace.

TASK [script] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<10.116.123.159\> EXEC mkdir -p $HOME/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180 && echo $HOME/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180  
\<10.116.123.159\> PUT /home/gaurav/deployment-automation/scripts/mailserverstage1.sh TO /home/openstack/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180/mailserverstage1.sh  
\<10.116.123.159\> EXEC chmod +rx /home/openstack/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180/mailserverstage1.sh  
\<10.116.123.159\> EXEC LANG=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /home/openstack/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180/mailserverstage1.sh -q -t 201 -s 2  
\<10.116.123.159\> EXEC rm -rf /home/openstack/.ansible/tmp/ansible-tmp-1436787876.28-251104705726180/ \>/dev/null 2\>&1  
fatal: [10.116.123.159]: FAILED! =\> {“msg”: “ERROR! ssh connection closed waiting for password prompt”, “failed”: true}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.116.123.159 : ok=5 changed=3 unreachable=0 failed=1

Appreciate any help.

Thanks,  
Gaurav

---

<div class="post-metadata">

**Author:** ![Uwe\_Sauter](https://avatars.discourse-cdn.com/v4/letter/u/41988e/32.png) [@Uwe\_Sauter](https://forum.ansible.com/u/Uwe_Sauter)\
**Post date:** [July 13, 2015, 1:23pm UTC](https://forum.ansible.com/t/sg-error-ssh-connection-closed-waiting-for-password-prompt-error/18740/2 "2015-07-13T13:23:26Z")

</div>

Can you access your host via SSH keys? You cannot use Ansible in a productive environment when you are asked for the password at  
each run…

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 13, 2015, 2:55pm UTC](https://forum.ansible.com/t/sg-error-ssh-connection-closed-waiting-for-password-prompt-error/18740/3 "2015-07-13T14:55:24Z")

</div>

yes you can, just pass -k to ansible and it will take care of passwords.
