# ansible privilege escalation ( sudo su - )

**URL:** <https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445>\
**Category:** Ansible Project\
**Created:** [March 12, 2020, 5:01am UTC](https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445 "2020-03-12T05:01:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suresh\_R](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Suresh\_R](https://forum.ansible.com/u/Suresh_R)\
**Post date:** [March 12, 2020, 5:01am UTC](https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445/1 "2020-03-12T05:01:51Z")

</div>

i have command sudo su - is working fine when we do ssh to the server. BTW we were unable to execute the same through ansible.

Here is my ansible playbook and ansible.cfg

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 12, 2020, 8:08am UTC](https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445/2 "2020-03-12T08:08:15Z")

</div>

You manually use sudo but the in your playbook you use su?

Please read again carefully  
[https://docs.ansible.com/ansible/latest/user\_guide/become.html](https://docs.ansible.com/ansible/latest/user_guide/become.html)

---

<div class="post-metadata">

**Author:** ![Suresh\_R](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Suresh\_R](https://forum.ansible.com/u/Suresh_R)\
**Post date:** [March 17, 2020, 7:59pm UTC](https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445/3 "2020-03-17T19:59:53Z")

</div>

can you provide the correct method for my situation ?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 17, 2020, 10:35pm UTC](https://forum.ansible.com/t/ansible-privilege-escalation-sudo-su/32445/4 "2020-03-17T22:35:39Z")

</div>

Probably - but only if you provide the details how privilege  
escalation is configured on your target host.
