# copying user ssh keys to machines

**URL:** <https://forum.ansible.com/t/copying-user-ssh-keys-to-machines/13196>\
**Category:** Ansible Project\
**Created:** [July 25, 2013, 2:46pm UTC](https://forum.ansible.com/t/copying-user-ssh-keys-to-machines/13196 "2013-07-25T14:46:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Lucas](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Michael\_Lucas](https://forum.ansible.com/u/Michael_Lucas)\
**Post date:** [July 25, 2013, 2:46pm UTC](https://forum.ansible.com/t/copying-user-ssh-keys-to-machines/13196/1 "2013-07-25T14:46:43Z")

</div>

Hi,

I need to copy user SSH authorized\_keys files to servers, as  
openssh-lpk has annoyed my organization for the last time. So we're  
using an /etc/ssh/users directory that contains all necessary user  
SSH.

The catch is, we don't want all of the keys on all of the  
machines. For example, the billing team needs their keys only on the  
billing servers. There's about a dozen different mixes of keys right  
now, but I know my coworkers and there will be more, plus exceptions  
and exclusions and who knows what.

My current plan is "write a playbook with a bunch of copy statements,  
and run a script to remove unrecognized/unwanted keys." But it seems  
that there's probably a more elegant way to do this.

Any suggestions on better ways to approach this?

There's always rsync, but maintaining a separate directory for each  
server group would be pretty durn annoying.

Thanks,  
==ml

---

<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 25, 2013, 2:50pm UTC](https://forum.ansible.com/t/copying-user-ssh-keys-to-machines/13196/2 "2013-07-25T14:50:43Z")

</div>

take a look at the authorized\_keys module, as for users-\>host mapping I do this in group files.
