# Issue with lib/ansible.egg-info/ ownership when running from source as different users

**URL:** <https://forum.ansible.com/t/issue-with-lib-ansible-egg-info-ownership-when-running-from-source-as-different-users/19671>\
**Category:** Ansible Project\
**Created:** [November 2, 2015, 2:23pm UTC](https://forum.ansible.com/t/issue-with-lib-ansible-egg-info-ownership-when-running-from-source-as-different-users/19671 "2015-11-02T14:23:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Calhoun\_Matt](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@Calhoun\_Matt](https://forum.ansible.com/u/Calhoun_Matt)\
**Post date:** [November 2, 2015, 2:23pm UTC](https://forum.ansible.com/t/issue-with-lib-ansible-egg-info-ownership-when-running-from-source-as-different-users/19671/1 "2015-11-02T14:23:14Z")

</div>

We have the need to run ansible from cron as root (to ensure the ‘ansible’ user exists on all remote hosts and its key is present in authorized\_keys) as well as the the ‘ansible’ user.

The problem is that when root sources ./hacking/env-setup, the directory lib/ansible.egg-info/ becomes owned by root and the ansible user can no longer run the ./hacking/env-setup without getting permission errors.

Is there a better way to have this work than maintaining two separate versions of the source code?

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [November 2, 2015, 3:09pm UTC](https://forum.ansible.com/t/issue-with-lib-ansible-egg-info-ownership-when-running-from-source-as-different-users/19671/2 "2015-11-02T15:09:31Z")

</div>

> We have the need to run ansible from cron as root (to ensure the  
> 'ansible' user exists on all remote hosts and its key is present in  
> authorized\_keys) as well as the the 'ansible' user.
> 
> The problem is that when root sources ./hacking/env-setup, the  
> directory lib/ansible.egg-info/ becomes owned by root and the ansible  
> user can no longer run the ./hacking/env-setup without getting  
> permission errors.

I posted about this too: [https://groups.google.com/forum/#!topic/ansible-project/0Il-9M0iyPE](https://groups.google.com/forum/#!topic/ansible-project/0Il-9M0iyPE)

I had said

&nbsp;&nbsp;In our particular case, we don't think we care if pkg\_resources knows  
&nbsp;&nbsp;about our off-in-a-corner-somewhere Ansible installation, and this would  
&nbsp;&nbsp;work fine for us if the 'rm -r' were an 'rm -rf' instead. (It'd fail,  
&nbsp;&nbsp;and we wouldn't ever know or care.)

We made this change in our local installation; if this behavior hasn't  
changed in 2.0, I'll make a PR then.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![Calhoun\_Matt](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@Calhoun\_Matt](https://forum.ansible.com/u/Calhoun_Matt)\
**Post date:** [November 2, 2015, 3:23pm UTC](https://forum.ansible.com/t/issue-with-lib-ansible-egg-info-ownership-when-running-from-source-as-different-users/19671/3 "2015-11-02T15:23:20Z")

</div>

Thanks Josh. I can confirm we’re using the latest code from the devel branch (2.0) and this is still occurring.
