# Unable to copy keys from management server to remote server

**URL:** <https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097>\
**Category:** Ansible Project\
**Created:** [April 27, 2015, 9:38pm UTC](https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097 "2015-04-27T21:38:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj\_Desikavinayagomp](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Raj\_Desikavinayagomp](https://forum.ansible.com/u/Raj_Desikavinayagomp)\
**Post date:** [April 27, 2015, 9:38pm UTC](https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097/1 "2015-04-27T21:38:51Z")

</div>

Hello,

Following was the error message. Playbook creates the user but does not copy the keys from management server to destination server.

Am I missing something here?

ansible-playbook -vvvvv /etc/ansible/site.yml

msg: could not find src=/home/dummyuser1/.ssh/authorized\_keys

# master playbook file: site.yml

- hosts: ansible\_slaves

remote\_user: ansible

tasks:

- name: Add test user

user:

name=dummyuser

password='dummyuser’

groups=ansible

shell=/bin/bash

append=yes

- name: creates the .ssh directory

file: path=/home/dummyuser/.ssh state=directory

- name: Copying ssh key files

copy:

src=/home/dummyuser1/.ssh/authorized\_keys dest=/home/dummyuser/.ssh/authorized\_keys owner=dummyuser group=ansible mode=600

sudo: yes

---

<div class="post-metadata">

**Author:** ![Raj\_Desikavinayagomp](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Raj\_Desikavinayagomp](https://forum.ansible.com/u/Raj_Desikavinayagomp)\
**Post date:** [April 28, 2015, 12:13am UTC](https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097/2 "2015-04-28T00:13:59Z")

</div>

Hello,  
This is due to a permission issue in the management server. To test it, I copied the file to /tmp and checked and it worked.

Now to fix this permanently, how do I have sudo for “src”. This is the reason it is not working.

Thanks  
dnraj

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 28, 2015, 12:15am UTC](https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097/3 "2015-04-28T00:15:28Z")

</div>

sudo ansible-playbook ....

or use a local action with sudo: true that copies the key to temporary  
spot for you to be able to use with copy.

---

<div class="post-metadata">

**Author:** ![Raj\_Desikavinayagomp](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Raj\_Desikavinayagomp](https://forum.ansible.com/u/Raj_Desikavinayagomp)\
**Post date:** [April 28, 2015, 12:24am UTC](https://forum.ansible.com/t/unable-to-copy-keys-from-management-server-to-remote-server/18097/4 "2015-04-28T00:24:21Z")

</div>

Hello brian,  
Thanks and it is working now.

thanks  
dnraj
