# Sorry, user xxxxx is not allowed to execute '/bin/sh -c echo BECOME-SUCCESS

**URL:** <https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820>\
**Category:** Ansible Project\
**Created:** [March 10, 2016, 12:11am UTC](https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820 "2016-03-10T00:11:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Roman](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Juan\_Roman](https://forum.ansible.com/u/Juan_Roman)\
**Post date:** [March 10, 2016, 12:11am UTC](https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820/1 "2016-03-10T00:11:58Z")

</div>

Sorry is this has been posted and answered by I find nothing while searching. I’m attempting to connect to my AIX server but can’t sudo.

Here’s my sudo setup.

xxxxx ALL=(ALL) /usr/bin/su -,/usr/bin/su -

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<[aixserver.com](http://aixserver.com)\> ESTABLISH CONNECTION FOR USER: userXX  
\<[aixserver.com](http://aixserver.com)\> REMOTE\_MODULE setup CHECKMODE=True  
\<[aixserver.com](http://aixserver.com)\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/userXX/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 [aixserver.com](http://aixserver.com) /bin/sh -c ‘mkdir -p /tmp/ansible-tmp-1457568234.68-267839190034318 && chmod a+rx /tmp/ansible-tmp-1457568234.68-267839190034318 && echo /tmp/ansible-tmp-1457568234.68-267839190034318’  
\<[aixserver.com](http://aixserver.com)\> PUT /tmp/tmpMNXTOm TO /tmp/ansible-tmp-1457568234.68-267839190034318/setup  
\<[aixserver.com](http://aixserver.com)\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/userXX/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 [aixserver.com](http://aixserver.com) /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=stujpsrxsgjiigrjvzefkwkrkuvaxyhs] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-stujpsrxsgjiigrjvzefkwkrkuvaxyhs; LANG=C LC\_CTYPE=C /usr/bin/python /tmp/ansible-tmp-1457568234.68-267839190034318/setup; rm -rf /tmp/ansible-tmp-1457568234.68-267839190034318/ \>/dev/null 2\>&1’”‘"’’  
failed: [[aixserver.com](http://aixserver.com)] =\> {“failed”: true, “parsed”: false}

Sorry, user userXX is not allowed to execute ‘/bin/sh -c echo BECOME-SUCCESS-stujpsrxsgjiigrjvzefkwkrkuvaxyhs; LANG=C LC\_CTYPE=C /usr/bin/python /tmp/ansible-tmp-1457568234.68-267839190034318/setup; rm -rf /tmp/ansible-tmp-1457568234.68-267839190034318/ \>/dev/null 2\>&1’ as root on ti1wps2.  
debug1: mux\_client\_request\_session: master session id: 2  
debug3: mux\_client\_read\_packet: read header failed: Broken pipe  
debug2: Received exit status from master 1  
Shared connection to [aixserver.com](http://aixserver.com) closed.

TASK: [iib-bin | Change Directory to $IIB\_ROOT\_INSTALL] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
FATAL: no hosts matched or all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/userXX/site.retry

[aixserver.com](http://aixserver.com) : ok=0 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![Mark\_Janssen](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark\_Janssen](https://forum.ansible.com/u/Mark_Janssen)\
**Post date:** [March 10, 2016, 1:05pm UTC](https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820/2 "2016-03-10T13:05:19Z")

</div>

Ansible needs to be able to run ‘ALL’ commands…

so:

xxxx ALL=(ALL) ALL

As it doesn’t run su or anything directly, but runs python which exec’s stuff later.

Mark

---

<div class="post-metadata">

**Author:** ![Ricardo\_Esteves](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Ricardo\_Esteves](https://forum.ansible.com/u/Ricardo_Esteves)\
**Post date:** [November 14, 2016, 2:06pm UTC](https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820/3 "2016-11-14T14:06:52Z")

</div>

What about on cases that you can’t have ALL on the sudoers?

For example i can’t execute /bin/sh with sudo, is there any way to make the module not execute /bin/sh first? Just execute the commands without /bin/sh in the beginning?

---

<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:** [November 14, 2016, 4:23pm UTC](https://forum.ansible.com/t/sorry-user-xxxxx-is-not-allowed-to-execute-bin-sh-c-echo-become-success/20820/4 "2016-11-14T16:23:07Z")

</div>

Only with ‘raw’, every other module needs a shell and a interpreter (normally python), ansible does not execute shell commands directly in most cases but a script.
