# Is it possible to use the su and sudo at the task?

**URL:** <https://forum.ansible.com/t/is-it-possible-to-use-the-su-and-sudo-at-the-task/22033>\
**Category:** Ansible Project\
**Created:** [July 16, 2016, 12:31am UTC](https://forum.ansible.com/t/is-it-possible-to-use-the-su-and-sudo-at-the-task/22033 "2016-07-16T00:31:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user84](https://avatars.discourse-cdn.com/v4/letter/u/71e660/32.png) [@user84](https://forum.ansible.com/u/user84)\
**Post date:** [July 16, 2016, 12:31am UTC](https://forum.ansible.com/t/is-it-possible-to-use-the-su-and-sudo-at-the-task/22033/1 "2016-07-16T00:31:25Z")

</div>

Hi,

I’m trying to use Ansible in my production.

I’d like to do the following command in Ansible.  
Is it possible?

`$ ssh user_a@xxx $ su user_b $ sudo xxx`

In my production,  
user\_a is only user allowed to SSH connection.  
And user\_b is only user allowed to become sudo.

In this situation, is there any good idea?

---

<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:** [September 9, 2016, 6:23pm UTC](https://forum.ansible.com/t/is-it-possible-to-use-the-su-and-sudo-at-the-task/22033/2 "2016-09-09T18:23:10Z")

</div>

You cannot chain privilege escalation methods within Ansible, you CAN use `become + shell: su ....`
