When using Git or SSH copy / remote login, etc., Should I reuse the same SSH keys or create new ones every time?

With the increasing use of Git or SSH copy or login, we can use only 1 pair of public and private keys, or we can probably create different pairs on different machines, for example, 1 for a laptop and 1 for a desktop and 1 for a virtual machine .

Should we use 1 pair or should we use several pairs?

If we use only one pair, we need to copy 2 files (public and private) to other machines, and we need to make sure that we do not do it via FTP, otherwise this information can be leaked to the public?

Even if we use SFTP, we need to configure the server on computers where we want to transfer from / to ... or is there a better method?

Typically, most programs and systems allow users to have multiple SSH keys? For example, when we use a GitHub or Heroku account, do the systems have an agreement that they allow the user to use multiple SSH keys to identify the same person?

I think that if we use several keys, a small problem may arise: if we create such keys on Ubuntu 10.04, and then install Ubuntu 10.10 later and create new keys, then we may have keys very soon, t know where they came from for example, a couple that was from Ubuntu 8.04, and we did not know about it.

+4
source share
1 answer

The rules for SSH keys are simple:

  • Create a new public / private key pair for each machine that you are going to authenticate.
  • Never copy the private key to another computer, either by network or removable media, or by any other method that you can think of.
  • Never share a password or passphrase with anyone and never write them down.
  • If you suspect that the key has been compromised, create a new one. The only cost is updating the public key services.
+5
source

All Articles