Does it matter where I generate my ssh key pair?
Matthew Barrera
Does it matter where I generate my key pair? Where should I store the private key and where should I copy the public key? I am a complete noob on this matter. I do know the private key should be stored somewhere safe.
2 Answers
The public key goes to machines you want to connect to, and the private key goes to machine you want to connect from. This allows you to send the same public key to several machines and, if one of them gets hacked, not to worry about the others.
It is most simple to generate a pair on your local machine (the one you use). By default, keys go to .ssh/id_rsa and .ssh/id_rsa.pub.
Should be stored locally in ~/.ssh .
Should be transfered to server with ssh-copy-id .
Example ssh-copy-id -i key_name user@server , change name of key, user name, and server name to match your user/server .
See or ssh documentation for details.