I know one way, running on a list of server like so:

for server in $(cat server.list); do
ssh-copy-id user@host

But I was wondering if there's a better way to do it? something automatic which will not require any user input. Can NIS do that?

  • Store that public key in your configuration management tooling and use that to deploy? – HBruijn Oct 30 '14 at 11:39
  • We haven't finished implementing Puppet yet, so there's no better way than that? – Itai Ganot Oct 30 '14 at 11:43

If your shop uses a configuration management tool such as Puppet, CFEngine, Chef, etc, that would be the easiest way.

If not, but you have an directory service that does LDAP, there is an extension to OpenSSH to store public keys in the directory.

Lastly, you can wrap the public keys into an RPM and distribute them like you would software. This would also help with lifecycle management, such as replacing, adding, removing keys are essentially solved problems.

| improve this answer | |
  • 1
    Wrapping the public keys into an RPM is a great solution! thanks. – Itai Ganot Oct 30 '14 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.