# how to run task as unprivileged user

**URL:** <https://forum.ansible.com/t/how-to-run-task-as-unprivileged-user/24259>\
**Category:** Ansible Project\
**Created:** [April 20, 2017, 6:31am UTC](https://forum.ansible.com/t/how-to-run-task-as-unprivileged-user/24259 "2017-04-20T06:31:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user22](https://avatars.discourse-cdn.com/v4/letter/u/e47774/32.png) [@user22](https://forum.ansible.com/u/user22)\
**Post date:** [April 20, 2017, 6:31am UTC](https://forum.ansible.com/t/how-to-run-task-as-unprivileged-user/24259/1 "2017-04-20T06:31:59Z")

</div>

Good day.  
I have a sudo user(user1) on the server and i need to run a task as another unprivilleged user(user2). A dont know a password for user2 and regular way to run something as user2 that login as user1 run “sudo -i”, run “su user2” and run something else.  
And now a qestion, how can i do this in play book?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 20, 2017, 4:58pm UTC](https://forum.ansible.com/t/how-to-run-task-as-unprivileged-user/24259/2 "2017-04-20T16:58:47Z")

</div>

You can't stack multiple sudo/su in Ansible.

But if you can run "sudo -u user2 \<command\>" as user1 then you can use Ansible to make it work.
