# \--private-key broken???

**URL:** <https://forum.ansible.com/t/private-key-broken/18479>\
**Category:** Ansible Project\
**Created:** [June 11, 2015, 8:00pm UTC](https://forum.ansible.com/t/private-key-broken/18479 "2015-06-11T20:00:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimon](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dimon](https://forum.ansible.com/u/Dimon)\
**Post date:** [June 11, 2015, 8:00pm UTC](https://forum.ansible.com/t/private-key-broken/18479/1 "2015-06-11T20:00:06Z")

</div>

Hi,

I’m trying to fire ansible from cron job and am failing as --private-key directive doesn’t seem to have effect. I can replicate the issue from CLI as well. So to illustrate:

$ ssh -i /home/ansible/.ssh/id\_rsa\_ansible\_key [root@server.com](mailto:root@server.com) hostname  
[server.com](http://server.com)  
$ /usr/bin/ansible-playbook --private-key=/home/ansible/.ssh/id\_rsa\_ansible\_key -u root -t info -i inventory my\_playbook.yml

PLAY [web] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [[server.com](http://server.com)] =\> SSH Error: muxserver\_listen bind(): Permission denied  
while connecting to 1.2.3.4:22  
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

TASK: [task1 | retrieve info] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
FATAL: no hosts matched or all hosts have already failed – aborting

I have also tried to launch with more verbose output, from which I get:

ssh -C -tt -vvv -o ControlMaster=auto -o ControlPath=%r-%h-%p -o StrictHostKeyChecking=no -o Port=22 -o IdentityFile=“/home/ansible/.ssh/id\_rsa\_ansible\_key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 [server.com](http://server.com) /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1434052273.15-260807475369322 && echo $HOME/.ansible/tmp/ansible-tmp-1434052273.15-260807475369322

so apparently it’s attempting to pass proper file to SSH, but somehow it doesn’t work? So I ran above ssh command (shortened a bit):

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPath=%r-%h-%p -o StrictHostKeyChecking=no -o Port=22 -o IdentityFile=“/home/ansible/.ssh/id\_rsa\_ansible\_key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 [server.com](http://server.com)  
…

debug1: Offering public key: /home/ansible/.ssh/id\_rsa\_ansible\_key  
debug3: send\_pubkey\_test  
debug2: we sent a publickey packet, wait for reply  
debug3: Wrote 368 bytes for a total of 1645  
debug1: Server accepts key: pkalg ssh-rsa blen 277  
debug2: input\_userauth\_pk\_ok: SHA1 fp   
debug3: sign\_and\_send\_pubkey: RSA   
debug1: read PEM private key done: type RSA  
debug3: Wrote 640 bytes for a total of 2285  
debug1: Enabling compression at level 6.  
debug1: Authentication succeeded (publickey).

…

debug3: muxserver\_listen: temporary control path root-server.com-22.sGN6uqisXSNkH0PM  
muxserver\_listen bind(): Permission denied

Note, that when I launch same playbook from my user account with my key file preloaded - no issues. So it is not that key authentication doesn’t work with Ansible, it’s the --private-key that introduces something that breaks connection, now what?
