# failed while connecting to remote hosts

**URL:** <https://forum.ansible.com/t/failed-while-connecting-to-remote-hosts/20123>\
**Category:** Ansible Project\
**Created:** [January 5, 2016, 12:57am UTC](https://forum.ansible.com/t/failed-while-connecting-to-remote-hosts/20123 "2016-01-05T00:57:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravi\_Kavali](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Ravi\_Kavali](https://forum.ansible.com/u/Ravi_Kavali)\
**Post date:** [January 5, 2016, 12:57am UTC](https://forum.ansible.com/t/failed-while-connecting-to-remote-hosts/20123/1 "2016-01-05T00:57:24Z")

</div>

able to connect few hosts but not all, i get the following error

hostnamexxx | FAILED \>\> {“failed”: true, “msg”: “\r\nSorry, user user123 is not allowed to execute ‘/bin/sh -c echo BECOME-SUCCESS-ulmhjizflgyappzkndibaykuvymkwnds; LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /tmp/ansible-tmp-1451954748.36-250854743528657/command’ as appuser on .\r\n”, “parsed”: false}

command used to connect to remote hosts :

$ansible testuat -i dev -u user123 -ks -U appuser -K -m command -a “uptime” -o

SSH password:

SUDO password[defaults to SSH password]:

testuat is the inventory file

my requirement

ssh to—\> user123@bastian host ----\>ssh user123@acutal host —\> sudo su - appuser

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 5, 2016, 2:33am UTC](https://forum.ansible.com/t/failed-while-connecting-to-remote-hosts/20123/2 "2016-01-05T02:33:38Z")

</div>

Per that error, user123 is not permitted to execute /bin/sh as appuser via sudo:

Sorry, user user123 is not allowed to execute ‘/bin/sh…’ as appuser on \<hostnamexxxxx
