/etc not writable

Hi,

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

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

No luck

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.

Thanks Kai Stian Olstad,

I changed as you suggested become_user: root, working now.

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

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

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

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

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

Fayad

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