# Cannot change to '/root/..' with sudo\_user

**URL:** <https://forum.ansible.com/t/cannot-change-to-root-with-sudo-user/15299>\
**Category:** Ansible Project\
**Created:** [May 21, 2014, 7:48pm UTC](https://forum.ansible.com/t/cannot-change-to-root-with-sudo-user/15299 "2014-05-21T19:48:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Stewart](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@Ryan\_Stewart](https://forum.ansible.com/u/Ryan_Stewart)\
**Post date:** [May 21, 2014, 7:48pm UTC](https://forum.ansible.com/t/cannot-change-to-root-with-sudo-user/15299/1 "2014-05-21T19:48:44Z")

</div>

I’m running a playbook where remote\_user is root, and on some tasks, I use “sudo: yes” with “sudo\_user: jenkins” to do some per-user setup. At the moment, I’m trying to clone a git repo. Whether I use the git module or the command module to run “git clone” directly, it keeps failing with:

stderr: fatal: Cannot change to ‘/root/…’: Permission denied

I can work around this by using the command module and adding “chdir=/tmp” to it. I don’t know why this works, but it seems there’s no other way to do it when using remote\_user=root, sudo=yes, and sudo\_user=. Help?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 21, 2014, 9:47pm UTC](https://forum.ansible.com/t/cannot-change-to-root-with-sudo-user/15299/2 "2014-05-21T21:47:27Z")

</div>

What version of ansible are you running? Version 1.6 should include a fix for this.
