# copy module && permissions

**URL:** <https://forum.ansible.com/t/copy-module-permissions/15610>\
**Category:** Ansible Project\
**Created:** [July 4, 2014, 3:29pm UTC](https://forum.ansible.com/t/copy-module-permissions/15610 "2014-07-04T15:29:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Edelman](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@Jason\_Edelman](https://forum.ansible.com/u/Jason_Edelman)\
**Post date:** [July 4, 2014, 3:29pm UTC](https://forum.ansible.com/t/copy-module-permissions/15610/1 "2014-07-04T15:29:00Z")

</div>

Hello,

It seems I have permissioning issues, but cannot seem to get it right when using the copy module.

Using the command module, this works fine: “sudo cp /home/jedelman/.ssh/authorized\_keys /root/.ssh/”

Using the copy module, this does not work: “src=/home/jedelman/.ssh/authorized\_keys dest=/root/.ssh/”

!!!

Error shown with -vvvv:

TASK: [copy auth keys] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<192.168.1.51\> ESTABLISH CONNECTION FOR USER: root  
failed: [192.168.1.51] =\> {“failed”: true}  
msg: could not find src=/home/jedelman/.ssh/authorized\_keys

FATAL: all hosts have already failed – aborting

!!!

remote\_user: root …is being used (FYI- I can login with root@x.x.x.x with no password just fine and issue “cp /home/jedelman/.ssh/authorized\_keys /root/.ssh/” and just fine.

!!!

I’ve been messing with the permissions, but here is where they are now:  
!!!

root@s1-1:/home/jedelman# ls -l .ssh  
total 8  
-rwx------ 1 root root 1191 Jul 4 10:06 authorized\_keys

Initially jedelman/jedelman was group/owner, but like I said, been trying to get this to work.

!!!

root@s1-1:/home/jedelman# ls -ld .ssh  
drw-rw-r-- 2 root root 4096 Jul 3 14:30 .ssh

!!!

root@s1-1:/home/jedelman# ls -la  
total 180  
drwxr-xr-x 24 jedelman jedelman 4096 Jul 3 14:28 .  
drwxr-xr-x 3 root root 4096 Jul 2 16:32 …  
drwxrwxr-x 3 jedelman jedelman 4096 Jul 3 14:28 .ansible  
-rw------- 1 jedelman jedelman 476 Jul 4 10:18 .bash\_history  
-rw-r–r-- 1 jedelman jedelman 220 Jul 2 16:32 .bash\_logout  
-rw-r–r-- 1 jedelman jedelman 3486 Jul 2 16:32 .bashrc  
drwx------ 15 jedelman jedelman 4096 Jul 3 09:51 .cache  
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .compiz  
drwx------ 10 jedelman jedelman 4096 Jul 2 21:11 .config  
drwxrwxr-x 2 jedelman jedelman 4096 Jul 4 10:34 configs  
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .dbus  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Desktop  
-rw-r–r-- 1 jedelman jedelman 25 Jul 3 10:54 .dmrc  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Documents  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Downloads  
-rw-r–r-- 1 jedelman jedelman 8445 Jul 2 16:32 examples.desktop  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 21:02 .fontconfig  
drwx------ 4 jedelman jedelman 4096 Jul 3 10:54 .gconf  
drwx------ 4 jedelman jedelman 4096 Jul 2 16:38 .gnome2  
-rw------- 1 jedelman jedelman 0 Jul 2 16:38 .goutputstream-7FVRIX  
-rw------- 1 jedelman jedelman 0 Jul 2 21:07 .goutputstream-T73BIX  
-rw-rw-r-- 1 jedelman jedelman 152 Jul 3 10:54 .gtk-bookmarks  
drwx------ 2 jedelman jedelman 4096 Jul 2 16:38 .gvfs  
-rw------- 1 jedelman jedelman 1518 Jul 3 10:54 .ICEauthority  
drwxr-xr-x 3 jedelman jedelman 4096 Jul 2 16:38 .local  
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .mission-control  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Music  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Pictures  
-rw-r–r-- 1 jedelman jedelman 675 Jul 2 16:32 .profile  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Public  
drwx------ 2 jedelman jedelman 4096 Jul 3 10:54 .pulse  
-rw------- 1 jedelman jedelman 256 Jul 2 16:38 .pulse-cookie  
drw-rw-r-- 2 root root 4096 Jul 3 14:30 .ssh  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Templates  
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Videos  
-rw------- 1 root root 740 Jul 3 10:50 .viminfo  
-rw------- 1 jedelman jedelman 49 Jul 3 10:54 .Xauthority  
-rw------- 1 jedelman jedelman 9461 Jul 3 10:54 .xsession-errors  
-rw------- 1 jedelman jedelman 18224 Jul 3 10:50 .xsession-errors.old  
root@s1-1:/home/jedelman#

Any help would be greatly appreciated.

Thanks,  
Jason

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 4, 2014, 3:38pm UTC](https://forum.ansible.com/t/copy-module-permissions/15610/2 "2014-07-04T15:38:00Z")

</div>

copy src needs to exist on the machine you execute ansible from (master)  
not on the target host. The reason the command module works is because it  
ALL gets executed on the target machine. copy is meant to be done ACROSS  
hosts, not on single host.

---

<div class="post-metadata">

**Author:** ![Jason\_Edelman](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@Jason\_Edelman](https://forum.ansible.com/u/Jason_Edelman)\
**Post date:** [July 4, 2014, 3:44pm UTC](https://forum.ansible.com/t/copy-module-permissions/15610/3 "2014-07-04T15:44:39Z")

</div>

WOW, thank you, and it states it right in the synopsis in the copy module. I feel great. Is there another more “Ansibley” way to do what I’m trying to accomplish or is command module the best way ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 4, 2014, 4:17pm UTC](https://forum.ansible.com/t/copy-module-permissions/15610/4 "2014-07-04T16:17:38Z")

</div>

command or shell, there is also the syncronize module that might work with  
delegate\_to, but command might be simplest to use.
