# SSH timeout?

**URL:** <https://forum.ansible.com/t/ssh-timeout/11803>\
**Category:** Ansible Project\
**Created:** [August 16, 2012, 7:13pm UTC](https://forum.ansible.com/t/ssh-timeout/11803 "2012-08-16T19:13:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 16, 2012, 7:13pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/1 "2012-08-16T19:13:38Z")

</div>

bash-3.2$ ansible WS000 -m command -a "echo dork" -u jmarcus -f 1 -K  
sudo password:  
ws002.test.com | FAILED =\> ssh connection closed waiting for password prompt

Is this configurable?

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 16, 2012, 7:17pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/2 "2012-08-16T19:17:42Z")

</div>

while the timeout is configurable (see --help) this is more of a sign you got the password wrong or the password prompt was unexpectedly strange. More likely the former.

---

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 16, 2012, 7:21pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/3 "2012-08-16T19:21:22Z")

</div>

Could it be that sftp is disabled?

James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 16, 2012, 7:26pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/4 "2012-08-16T19:26:36Z")

</div>

nah, it hasn’t tried to SFTP yet.

what version of ansible are you using? (ansible --version)?

Older versions of sudo didn’t support “–” and new versions omit it.  
(Also what OS/version is your remote host?)

also: you should be able to use “-v -v -v” to see what commands are being executed to try them manually and learn a bit more.

---

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 16, 2012, 7:35pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/5 "2012-08-16T19:35:44Z")

</div>

bash-3.2$ ansible --version  
ansible 0.7

Local OS is OSX 10.7  
Remove OS is CentOS 5.8

Is this helpful?

bash-3.2$ ansible WS000 -m command -a "echo dork" -u jmarcus -f 1 -K -T 10 -vvvv  
sudo password:  
\<ws002.test.com\> ESTABLISH CONNECTION FOR USER: jmarcus  
\<ws002.test.com\> EXEC "$SHELL" -c 'mkdir -p  
$HOME/.ansible/tmp/ansible-1345145182.42-97158060563974 && chmod a+rx  
$HOME/.ansible/tmp/ansible-1345145182.42-97158060563974 && echo  
$HOME/.ansible/tmp/ansible-1345145182.42-97158060563974'  
\<ws002.test.com\> REMOTE\_MODULE command echo dork  
\<ws002.test.com\> PUT  
/var/folders/\_s/lmr53wfd0xz81v8\_0x317x4h0000gn/T/tmpedKYi0 TO  
/home/jmarcus/.ansible/tmp/ansible-1345145182.42-97158060563974/command  
\<ws002.test.com\> EXEC "$SHELL" -c 'chmod u+x  
/home/jmarcus/.ansible/tmp/ansible-1345145182.42-97158060563974/command'  
\<ws002.test.com\> EXEC sudo -k && sudo -p "[sudo via ansible,  
key=enldcknfdpvkqgtatcedmjefiegvoevge] password: " -u root "$SHELL" -c  
/home/jmarcus/.ansible/tmp/ansible-1345145182.42-97158060563974/command

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 16, 2012, 8:08pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/6 "2012-08-16T20:08:22Z")

</div>

I'm not going to be able to debug it for you, but you should be able  
to learn more from this last part:

> \<ws002.test.com\> EXEC sudo -k && sudo -p "[sudo via ansible,  
> key=enldcknfdpvkqgtatcedmjefiegvoevge] password: " -u root "$SHELL" -c  
> /home/jmarcus/.ansible/tmp/ansible-1345145182.42-97158060563974/command

You probably just want to try executing that directly with  
/usr/bin/ssh and seeing what you get.

---

<div class="post-metadata">

**Author:** ![ericC](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ericC](https://forum.ansible.com/u/ericC)\
**Post date:** [December 28, 2012, 9:45pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/7 "2012-12-28T21:45:53Z")

</div>

I encountered the same problem, and the issue was the /etc/sudoers did NOT require a password but I was passing the password via --sudo --ask-sudo-pass.

It appears that (at least on Scientific Linux 6.3 and sudo-1.7.4p5-12.el6\_3.x86\_64 on both machines), the password options must be in sync between Ansible and /etc/sudoers.

That is, if you use the Ansible options --sudo and --ask-sudo-pass, the host sudoers file MUST require that user to use a password. Conversly, if you use Ansible without the sudo password option, the host sudoers file MUST NOT require that user to use a password.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 28, 2012, 10:00pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/8 "2012-12-28T22:00:56Z")

</div>

I've hit this issue before also, I just fixed my sudoers to be consistent.

---

<div class="post-metadata">

**Author:** ![larry\_tjoelker](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@larry\_tjoelker](https://forum.ansible.com/u/larry_tjoelker)\
**Post date:** [March 18, 2013, 9:41pm UTC](https://forum.ansible.com/t/ssh-timeout/11803/9 "2013-03-18T21:41:23Z")

</div>

I know this is old, but for the sake of documentation, I had this problem and it turned out  
to be a bad line in the sudoers file (which I was editing), so after the first run the error appeared.
