7

Is it good practice to copy SSH IDs a la ssh-copy-id between remote servers in production, so that they can perform various SSH tasks with one another easier?

In particular, I'm setting up SSH tunnels and don't like to have to look up the very arcane passwords those servers have set. If I ssh-copy-id between the servers that are participating, is this a security risk?

1 Answer 1

10

Is it good practice to copy SSH IDs a la ssh-copy-id between remote servers in production, so that they can perform various SSH tasks with one another easier?

Yes, absolutely. Keep separate keys for each system, assigned to accounts with the least-needed privileges on each server. If possible use the command= directive in the authorized_keys file to restrict each key to a specific command, instead of having access to a full shell.

Another good practice you should do ASAP is to disable password authentication.

7
  • My concern is that if one of these servers is compromised, they're able to SSH any other server that recognizes its host key. That is, any of those other servers I've done ssh-copy-id to from the compromised server, and without any additional requirements on their part (such as the password, that isn't stored on the server). Jun 22, 2015 at 14:29
  • 2
    OK, the only system you should be copying your keys around from is your workstation. Period. Your private key gets generated there, and it should never be copied elsewhere. There's no good reason your private key should ever need to be copied elsewhere.
    – EEAA
    Jun 22, 2015 at 15:15
  • 1
    Sorry I think you misunderstand. I have my workstation, and remote servers A, and B. I want A and B to be able to SSH each other without entering their individual passwords. My workstation doesn't come into it. My concern is that if A or B is compromised, so is the other. Jun 22, 2015 at 15:42
  • 4
    In that case, keep separate keys for each system, assigned to accounts with the least-needed privileges on each server. If possible use the command= directive in the authorized_keys file to restrict each key to a specific command, instead of having access to a full shell.
    – EEAA
    Jun 22, 2015 at 15:50
  • Those keys aren't for root, are they? Use least privilege to minimize the impact that a compromise on A could have on B. Chroot where possible or as @EEAA said, command restrictions. Jun 22, 2015 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .