# rksh does not allow me to run /bin/sh -c so ansible failes

**URL:** <https://forum.ansible.com/t/rksh-does-not-allow-me-to-run-bin-sh-c-so-ansible-failes/31078>\
**Category:** Ansible Project\
**Created:** [August 20, 2019, 4:26pm UTC](https://forum.ansible.com/t/rksh-does-not-allow-me-to-run-bin-sh-c-so-ansible-failes/31078 "2019-08-20T16:26:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Van\_de\_Velde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tom_van_de_velde/32/10548_2.png) [@Tom\_Van\_de\_Velde](https://forum.ansible.com/u/Tom_Van_de_Velde)\
**Post date:** [August 20, 2019, 4:26pm UTC](https://forum.ansible.com/t/rksh-does-not-allow-me-to-run-bin-sh-c-so-ansible-failes/31078/1 "2019-08-20T16:26:36Z")

</div>

Hi,

I want to use Ansible to a target using an ssh connection and a restricted shell…

I have setup gather\_facts: false in my playbook, but even then Ansible is trying to guess the discovered\_interpreter\_python and returns an error because this is not allowed in the restricted shell.

\<sec\_system\> Attempting python interpreter discovery  
\<sec\_system\> ESTABLISH SSH CONNECTION FOR USER: secadmin  
\<sec\_system\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“padmin”’ -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/7c17f9a5a6 sec\_system ‘/bin/sh -c ‘"’“'echo PLATFORM; uname; echo FOUND; command -v '”’“'”‘"’“'”‘"’“‘/usr/bin/python’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python3.7’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python3.6’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python3.5’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python2.7’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python2.6’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘/usr/libexec/platform-python’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘/usr/bin/python3’”‘"’“'”‘"’“'”‘"’; command -v ‘"’“'”‘"’“'”‘"’“‘python’”‘"’“'”‘"’“'”‘"’; echo ENDFOUND && sleep 0’“'”‘’  
\<sec\_system\> (1, b’‘, b’rksh: /bin/sh: 0403-019 The operation is not allowed in a restricted shell.\n’)  
\<sec\_system\> Failed to connect to the host via ssh: rksh: /bin/sh: 0403-019 The operation is not allowed in a restricted shell.

So infact ansible is trying to /bin/sh -c into the system and this is not allowed…

Does anybody know how to prevent this check so I can use the raw command ?

Regards,  
Tom

ansible --version  
ansible 2.8.0  
config file = /home/user/git/ansible\_project/etc/ansible.cfg  
configured module search path = [‘/home/user/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible  
executable location = /usr/local/bin/ansible  
python version = 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
