# rootsh in Ansible for privilege escalation

**URL:** <https://forum.ansible.com/t/rootsh-in-ansible-for-privilege-escalation/29006>\
**Category:** Ansible Developer\
**Created:** [November 12, 2018, 2:17pm UTC](https://forum.ansible.com/t/rootsh-in-ansible-for-privilege-escalation/29006 "2018-11-12T14:17:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![write\_Bapun](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@write\_Bapun](https://forum.ansible.com/u/write_Bapun)\
**Post date:** [November 12, 2018, 2:17pm UTC](https://forum.ansible.com/t/rootsh-in-ansible-for-privilege-escalation/29006/1 "2018-11-12T14:17:47Z")

</div>

Hello All,

I am looking if Ansible supports rootsh for privilege escalation. I have tried all possible ways but i am not successful yet.

Documenation: [https://linux.die.net/man/1/rootsh](https://linux.die.net/man/1/rootsh)

If there is no module/plugin present for rootsh : My question is can i create a new module or plugin for rootsh for my use? I would like to know which source code files i need to modify for rootsh privilege escalation.

Here is my sudoer file:

## Allow root to run any commands anywhere

root ALL=(ALL) ALL  
poweruser ALL=(ALL) ALL  
normaluser ALL=(root) /usr/bin/rootsh /bin/su - poweruser

I would like to ssh using normaluser and then change the user to poweruser and run all sudo commands.

normal user only can run: sudo /usr/bin/rootsh /bin/su - poweruser  
it asks for password to change to poweruser

-Sam
