# /etc not writable

**URL:** <https://forum.ansible.com/t/etc-not-writable/21373>\
**Category:** Ansible Project\
**Created:** [May 6, 2016, 12:46pm UTC](https://forum.ansible.com/t/etc-not-writable/21373 "2016-05-06T12:46:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sanjay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Sanjay\_Kumar](https://forum.ansible.com/u/Sanjay_Kumar)\
**Post date:** [May 6, 2016, 12:46pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/1 "2016-05-06T12:46:08Z")

</div>

Hi,

I am not able copy to remote host, getting not writable error, my playbook is here.

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 6, 2016, 1:38pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/2 "2016-05-06T13:38:28Z")

</div>

I am not sure if the copy module is as picky as rsync in regard to  
trailing slashes.

...dest=/etc/

Maybe use the full path:

...dest=/etc/messages

Johannes

---

<div class="post-metadata">

**Author:** ![Sanjay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Sanjay\_Kumar](https://forum.ansible.com/u/Sanjay_Kumar)\
**Post date:** [May 6, 2016, 2:28pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/3 "2016-05-06T14:28:58Z")

</div>

No luck

---

<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:** [May 6, 2016, 3:43pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/4 "2016-05-06T15:43:59Z")

</div>

become\_user: sanjay, means Ansible will do a sudo to user sanjay. So sanjay need permission to the destination.

I guess what you really want is become\_user: root , which is the default.

---

<div class="post-metadata">

**Author:** ![Sanjay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Sanjay\_Kumar](https://forum.ansible.com/u/Sanjay_Kumar)\
**Post date:** [May 9, 2016, 4:17am UTC](https://forum.ansible.com/t/etc-not-writable/21373/5 "2016-05-09T04:17:44Z")

</div>

Thanks Kai Stian Olstad,

I changed as you suggested become\_user: root, working now.

---

<div class="post-metadata">

**Author:** ![Yuriy\_Buha](https://avatars.discourse-cdn.com/v4/letter/y/3ab097/32.png) [@Yuriy\_Buha](https://forum.ansible.com/u/Yuriy_Buha)\
**Post date:** [July 21, 2017, 1:03pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/6 "2017-07-21T13:03:35Z")

</div>

Hello.

I have similar case, and i get this error, but i do need to create it as sudo user. I do not have root privilege.  
Can someone please advise?

Thank you

---

<div class="post-metadata">

**Author:** ![Fayad](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@Fayad](https://forum.ansible.com/u/Fayad)\
**Post date:** [July 21, 2017, 1:38pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/7 "2017-07-21T13:38:36Z")

</div>

Try these options

Copy the file to the sudo user’s home directory or any other directory where the user has got permission.

Or

Increase the permissions of the destination directory so that user can write into that directory.

Fayad

---

<div class="post-metadata">

**Author:** ![Yuriy\_Buha](https://avatars.discourse-cdn.com/v4/letter/y/3ab097/32.png) [@Yuriy\_Buha](https://forum.ansible.com/u/Yuriy_Buha)\
**Post date:** [July 22, 2017, 12:06pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/8 "2017-07-22T12:06:58Z")

</div>

Hi Fayad.

Thank you for the quick reply.  
I tried to create the file in user’s home directory, and then move to the /etc, but then i would get a permission error moving the file to that directory.  
It worked after i changed the ownership of /etc from root to the user, but i’m not sure if that’s a proper way to do. Is it ok for the /etc directory to be owned by the user but not root?

thank you

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [July 22, 2017, 3:53pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/9 "2017-07-22T15:53:53Z")

</div>

Nope, that's super bad. I thought you didn't have root access?

---

<div class="post-metadata">

**Author:** ![Fayad](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@Fayad](https://forum.ansible.com/u/Fayad)\
**Post date:** [July 28, 2017, 12:35pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/10 "2017-07-28T12:35:16Z")

</div>

Changing ownership of /etc is not a proper way. So you have root access??

Fayad

---

<div class="post-metadata">

**Author:** ![Yuriy\_Buha](https://avatars.discourse-cdn.com/v4/letter/y/3ab097/32.png) [@Yuriy\_Buha](https://forum.ansible.com/u/Yuriy_Buha)\
**Post date:** [August 1, 2019, 3:16pm UTC](https://forum.ansible.com/t/etc-not-writable/21373/11 "2019-08-01T15:16:22Z")

</div>

No, do not have root, but I do have sudo access that allows me to chown of /etc
