# Problems running ansible w/o root access

**URL:** <https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468>\
**Category:** Ansible Project\
**Tags:** rhel, ansible-project\
**Created:** [March 8, 2013, 4:47am UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468 "2013-03-08T04:47:41Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [March 8, 2013, 4:47am UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468/1 "2013-03-08T04:47:41Z")

</div>

> Running into some problems using Ansible on RHEL 5, installed/running as  
> regular user (no root access). Note - we use host based ssh authentication  
> on default port.

Ok, that's totally fine so far...

> Added the hacking/env-setup portion to my .bash\_profile to run in the  
> hacking setup. Added a couple hosts to my ANSIBLE\_HOSTS file. Verified I  
> have ssh access to those hosts, no password prompt.  
> Username/hostnames have been changed to protect the innocent 🙂
> 
> Try the ping command on the Getting Started page
> 
> $ ansible all -m ping

By default this will run as your user, you may wish to specify "-u  
username" to provide the remote user.

> /local/python/lib/python2.6/site-packages/pycrypto-2.6-py2.6-linux-x86\_64.egg/Crypto/Util/number.py:57:  
> PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using  
> libgmp \>= 5 to avoid timing attack vulnerability.

I have \*NOT\* seen the above warning, but I suspect it's not causing  
your connection problem.

Still you may wish to try -c ssh to use native OpenSSH.

Though from RHEL5 you won't have ControlPersist so that's a little  
suboptimal. Better to be using something a bit more current as the  
control node if possible.

> Next I created a generic ansible.cfg and the only major change I put was  
> adding -o HostbasedAuthentication to the ssh\_args, then changed connection  
> type to ssh.

Ok, now you're doing SSH 🙂

It does look like you're getting that warning just from importing  
paramiko so just upgrading paramiko may make  
that clear, in which case, it's not operational...

Unfortunate but it's RHEL5 so old pycrypto...

> $ ansible all -m ping -vvv --connection=ssh  
> /local/python/lib/python2.6/site-packages/pycrypto-2.6-py2.6-linux-x86\_64.egg/Crypto/Util/number.py:57:  
> PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using  
> libgmp \>= 5 to avoid timing attack vulnerability.  
> \<127.0.0.1\> ESTABLISH CONNECTION FOR USER: myuser  
> \<127.0.0.1\> EXEC ['ssh', '-tt', '-q', '-o', 'HostbasedAuthentication', '-o',  
> 'PasswordAuthentication=no', '-o', 'ControlMaster=auto', '-o',  
> 'ControlPersist=60s', '-o', 'ControlPath=/tmp/ansible-ssh-%h-%p-%r', '-o',  
> 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o',  
> 'KbdInteractiveAuthentication=no', '-o', 'PasswordAuthentication=no', '-o',  
> 'User=myuser', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p  
> $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800 && chmod a+rx  
> $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800 && echo  
> $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800'"]  
> \<host1\> ESTABLISH CONNECTION FOR USER: myuser  
> \<127.0.0.1\> REMOTE\_MODULE ping  
> \<host1\> EXEC ['ssh', '-tt', '-q', '-o', 'HostbasedAuthentication', '-o',  
> 'PasswordAuthentication=no', '-o', 'ControlMaster=auto', '-o',  
> 'ControlPersist=60s', '-o', 'ControlPath=/tmp/ansible-ssh-%h-%p-%r', '-o',  
> 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o',  
> 'KbdInteractiveAuthentication=no', '-o', 'PasswordAuthentication=no', '-o',  
> 'User=myuser', '-o', 'ConnectTimeout=10', 'host1', "/bin/sh -c 'mkdir -p  
> $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967 && chmod a+rx  
> $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967 && echo  
> $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967'"]  
> \<127.0.0.1\> PUT /tmp/tmpZ96vfa TO /ping  
> \<host1\> REMOTE\_MODULE ping  
> \<host1\> PUT /tmp/tmpcRZLhm TO /ping  
> \<host2\> ESTABLISH CONNECTION FOR USER: myuser  
> \<host2\> EXEC ['ssh', '-tt', '-q', '-o', 'HostbasedAuthentication', '-o',  
> 'PasswordAuthentication=no', '-o', 'ControlMaster=auto', '-o',  
> 'ControlPersist=60s', '-o', 'ControlPath=/tmp/ansible-ssh-%h-%p-%r', '-o',  
> 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o',  
> 'KbdInteractiveAuthentication=no', '-o', 'PasswordAuthentication=no', '-o',  
> 'User=myuser', '-o', 'ConnectTimeout=10', 'host2', "/bin/sh -c 'mkdir -p  
> $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965 && chmod a+rx  
> $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965 && echo  
> $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965'"]  
> host1 | FAILED =\> Traceback (most recent call last):  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 297, in  
> \_executor  
> &nbsp;&nbsp;&nbsp;&nbsp;exec\_rc = self.\_executor\_internal(host)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 354, in  
> \_executor\_internal  
> &nbsp;&nbsp;&nbsp;&nbsp;return self.\_executor\_internal\_inner(host, self.module\_name,  
> self.module\_args, inject, port)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 482, in  
> \_executor\_internal\_inner  
> &nbsp;&nbsp;&nbsp;&nbsp;result = handler.run(conn, tmp, module\_name, module\_args, inject,  
> self.complex\_args)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/action\_plugins/normal.py", line  
> 55, in run  
> &nbsp;&nbsp;&nbsp;&nbsp;return self.runner.\_execute\_module(conn, tmp, module\_name, module\_args,  
> inject=inject, complex\_args=complex\_args)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 250, in  
> \_execute\_module  
> &nbsp;&nbsp;&nbsp;&nbsp;(remote\_module\_path, is\_new\_style, shebang) = self.\_copy\_module(conn,  
> tmp, module\_name, args, inject, complex\_args)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 642, in  
> \_copy\_module  
> &nbsp;&nbsp;&nbsp;&nbsp;self.\_transfer\_str(conn, tmp, module\_name, module\_data)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/\_\_init\_\_.py", line 217, in  
> \_transfer\_str  
> &nbsp;&nbsp;&nbsp;&nbsp;conn.put\_file(afile, remote)  
> &nbsp;&nbsp;File "/local/ansible/lib/ansible/runner/connection\_plugins/ssh.py", line  
> 180, in put\_file  
> &nbsp;&nbsp;&nbsp;&nbsp;stdout, stderr = p.communicate(indata)  
> &nbsp;&nbsp;File "/local/python/lib/python2.6/subprocess.py", line 691, in communicate  
> &nbsp;&nbsp;&nbsp;&nbsp;return self.\_communicate(input)  
> &nbsp;&nbsp;File "/local/python/lib/python2.6/subprocess.py", line 1222, in  
> \_communicate  
> &nbsp;&nbsp;&nbsp;&nbsp;bytes\_written = os.write(self.stdin.fileno(), chunk)  
> OSError: [Errno 32] Broken pipe
> 
> 127.0.0.1 | FAILED =\> failed to transfer file to /ping:

> Connecting to 127.0.0.1...  
> command-line line 0: Missing yes/no argument.

Can you give the output of ansible --version here?

It seems quite unusual that it would try to put things in "/".

---

<div class="post-metadata">

**Author:** ![Brian\_Green](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@Brian\_Green](https://forum.ansible.com/u/Brian_Green)\
**Post date:** [March 8, 2013, 3:44pm UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468/2 "2013-03-08T15:44:28Z")

</div>

> > Running into some problems using Ansible on RHEL 5, installed/running as  
> > regular user (no root access). Note - we use host based ssh authentication  
> > on default port.
> 
> Ok, that’s totally fine so far…
> 
> > Added the hacking/env-setup portion to my .bash\_profile to run in the  
> > hacking setup. Added a couple hosts to my ANSIBLE\_HOSTS file. Verified I  
> > have ssh access to those hosts, no password prompt.  
> > Username/hostnames have been changed to protect the innocent 🙂
> > 
> > Try the ping command on the Getting Started page
> > 
> > $ ansible all -m ping
> 
> By default this will run as your user, you may wish to specify “-u  
> username” to provide the remote user.
> 
> > /local/python/lib/python2.6/site-packages/pycrypto-2.6-py2.6-linux-x86\_64.egg/Crypto/Util/number.py:57:  
> > PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using  
> > libgmp \>= 5 to avoid timing attack vulnerability.
> 
> I have _NOT_ seen the above warning, but I suspect it’s not causing  
> your connection problem.
> 
> Still you may wish to try -c ssh to use native OpenSSH.
> 
> Though from RHEL5 you won’t have ControlPersist so that’s a little  
> suboptimal. Better to be using something a bit more current as the  
> control node if possible.
> 
> > Next I created a generic ansible.cfg and the only major change I put was  
> > adding -o HostbasedAuthentication to the ssh\_args, then changed connection  
> > type to ssh.
> 
> Ok, now you’re doing SSH 🙂
> 
> It does look like you’re getting that warning just from importing  
> paramiko so just upgrading paramiko may make  
> that clear, in which case, it’s not operational…
> 
> Unfortunate but it’s RHEL5 so old pycrypto…
> 
> > $ ansible all -m ping -vvv --connection=ssh  
> > /local/python/lib/python2.6/site-packages/pycrypto-2.6-py2.6-linux-x86\_64.egg/Crypto/Util/number.py:57:  
> > PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using  
> > libgmp \>= 5 to avoid timing attack vulnerability.  
> > \<127.0.0.1\> ESTABLISH CONNECTION FOR USER: myuser  
> > \<127.0.0.1\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘HostbasedAuthentication’, ‘-o’,  
> > ‘PasswordAuthentication=no’, ‘-o’, ‘ControlMaster=auto’, ‘-o’,  
> > ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’,  
> > ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’,  
> > ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’,  
> > ‘User=myuser’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p  
> > $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800 && chmod a+rx  
> > $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800 && echo  
> > $HOME/.ansible/tmp/ansible-1362678139.9-159934362371800’”]  
> > ESTABLISH CONNECTION FOR USER: myuser  
> > \<127.0.0.1\> REMOTE\_MODULE ping  
> > EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘HostbasedAuthentication’, ‘-o’,  
> > ‘PasswordAuthentication=no’, ‘-o’, ‘ControlMaster=auto’, ‘-o’,  
> > ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’,  
> > ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’,  
> > ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’,  
> > ‘User=myuser’, ‘-o’, ‘ConnectTimeout=10’, ‘host1’, “/bin/sh -c ‘mkdir -p  
> > $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967 && chmod a+rx  
> > $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967 && echo  
> > $HOME/.ansible/tmp/ansible-1362678139.9-96113492751967’”]  
> > \<127.0.0.1\> PUT /tmp/tmpZ96vfa TO /ping  
> > REMOTE\_MODULE ping  
> > PUT /tmp/tmpcRZLhm TO /ping  
> > ESTABLISH CONNECTION FOR USER: myuser  
> > EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘HostbasedAuthentication’, ‘-o’,  
> > ‘PasswordAuthentication=no’, ‘-o’, ‘ControlMaster=auto’, ‘-o’,  
> > ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’,  
> > ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’,  
> > ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’,  
> > ‘User=myuser’, ‘-o’, ‘ConnectTimeout=10’, ‘host2’, “/bin/sh -c ‘mkdir -p  
> > $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965 && chmod a+rx  
> > $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965 && echo  
> > $HOME/.ansible/tmp/ansible-1362678139.91-241679509045965’”]  
> > host1 | FAILED =\> Traceback (most recent call last):  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 297, in  
> > \_executor  
> > exec\_rc = self.\_executor\_internal(host)  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 354, in  
> > \_executor\_internal  
> > return self.\_executor\_internal\_inner(host, self.module\_name,  
> > self.module\_args, inject, port)  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 482, in  
> > \_executor\_internal\_inner  
> > result = handler.run(conn, tmp, module\_name, module\_args, inject,  
> > self.complex\_args)  
> > File “/local/ansible/lib/ansible/runner/action\_plugins/normal.py”, line  
> > 55, in run  
> > return self.runner.\_execute\_module(conn, tmp, module\_name, module\_args,  
> > inject=inject, complex\_args=complex\_args)  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 250, in  
> > \_execute\_module  
> > (remote\_module\_path, is\_new\_style, shebang) = self.\_copy\_module(conn,  
> > tmp, module\_name, args, inject, complex\_args)  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 642, in  
> > \_copy\_module  
> > self.\_transfer\_str(conn, tmp, module\_name, module\_data)  
> > File “/local/ansible/lib/ansible/runner/ **init**.py”, line 217, in  
> > \_transfer\_str  
> > conn.put\_file(afile, remote)  
> > File “/local/ansible/lib/ansible/runner/connection\_plugins/ssh.py”, line  
> > 180, in put\_file  
> > stdout, stderr = p.communicate(indata)  
> > File “/local/python/lib/python2.6/subprocess.py”, line 691, in communicate  
> > return self.\_communicate(input)  
> > File “/local/python/lib/python2.6/subprocess.py”, line 1222, in  
> > \_communicate  
> > bytes\_written = os.write(self.stdin.fileno(), chunk)  
> > OSError: [Errno 32] Broken pipe
> > 
> > 127.0.0.1 | FAILED =\> failed to transfer file to /ping:
> 
> > Connecting to 127.0.0.1…  
> > command-line line 0: Missing yes/no argument.
> 
> Can you give the output of ansible --version here?

$ ansible --version  
/local/python/lib/python2.7/site-packages/pycrypto-2.6-py2.7-linux-x86\_64.egg/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to avoid timing attack vulnerability.  
ansible 1.1 (devel ca16a91da1) last updated 2013/03/06 16:26:11 (GMT -500)

> It seems quite unusual that it would try to put things in “/”.

I reran using Python 2.7.3 and still getting similar errors. I put the connection type as ssh in my ansible.cfg, tried with/without ssh arguments. Changed hosts file to just contain a single host.

$ ansible all -m ping -vvv  
/local/python/lib/python2.7/site-packages/pycrypto-2.6-py2.7-linux-x86\_64.egg/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz\_powm\_sec. You should rebuild using libgmp \>= 5 to avoid timing attack vulnerability.  
 ESTABLISH CONNECTION FOR USER: myuser on PORT 22 TO server1  
server1 | FAILED =\> FAILED: Authentication failed.

---

<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:** [March 8, 2013, 4:32pm UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468/3 "2013-03-08T16:32:55Z")

</div>

Ok, I don't have time to help debug today unfortunately.

Please stop by IRC and we should be able to help you there.

---

<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:** [March 8, 2013, 4:33pm UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468/4 "2013-03-08T16:33:18Z")

</div>

To clarify, IRC is

#ansible

irc.freenode.net

You can use webchat.freenode.net if you don't have a client.

---

<div class="post-metadata">

**Author:** ![Brian\_Green](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@Brian\_Green](https://forum.ansible.com/u/Brian_Green)\
**Post date:** [March 8, 2013, 10:53pm UTC](https://forum.ansible.com/t/problems-running-ansible-w-o-root-access/12468/5 "2013-03-08T22:53:45Z")

</div>

I think the problem is our ssh configuration. It is host based, and user based keys aren’t even checked/allowed. So Ansible/paramiko won’t be able to auth using the host-based key, and the user based authorized\_keys aren’t even used.

I think the best option is for me to get approval for my Ansible server’s public key to get in the authorized\_keys file managed by our platform team.
