5

I have a bunch of servers that need to transmit data to one server using SCP. What is the best practice for using SSH key-based authentication?

Option 1: Create a unique private key for each host and place the public key on the remote server?

Option 2: Copy the same private key to all the servers to connect to the remote server?

Or what other options would be available?

2

Using unique keys would be better from a security standpoint.

Create a unique key for each server and distribute it using the copy-ssh-id command.

Related: https://askubuntu.com/questions/4830/easiest-way-to-copy-ssh-keys-to-another-machine

1

It's best to generate a public and private key-pair for each host, and copy all public keys to one server.

When using public key cryptography the goal is to keep the private key secret. Option number 2 would mean that all hosts could impersonate the other hosts. While this might not seem like a bad idea for data transfers, SSH keys are also used for remote login. If any one host is compromised then all of the servers are compromised.

Keeping separate keys allows you as an admin to keep track of what transfers are occurring from what machines, as well as keeping server compromise to a minimum.

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.