Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.11 KB

README.md

File metadata and controls

43 lines (29 loc) · 1.11 KB

Generate / import a SSH key pair

Create a new key

ssh-keygen -t rsa -b 2048 -f ~/.ssh/<filename-for-the-private-key> -C "<human-name-for-the-key>" -N <super-strong-passphrase>
ssh-add ~/.ssh/<filename-for-the-private-key>
  • <filename-for-the-private-key>: you might end up having multiple key pairs for different purpose / environments. Choose a meaningful name.
  • <human-name-for-the-key>: will be part of the public key. It's useful to identify what a SSH public key is used for.
  • <super-strong-passphrase>: generate it randomly and store it securely, the longer the better.

Import an existing key

  • Create a new file in the ~/.ssh/ directory with the content of the Private Key.
  • Type ssh-add ~/.ssh/<filename-for-the-private-key>.

Export the public key

cat ~/.ssh/<filename-for-the-private-key>.pub

SSH

ssh -i ~/.ssh/<filename-for-the-private-key> <address>

Troubleshooting adding the key pair

If you get this error when typing ssh-add:

Could not open a connection to your authentication agent.

Run this:

eval "$(ssh-agent -s)"