Skip to content

Instantly share code, notes, and snippets.

@derozic
Created May 1, 2018 05:46
Show Gist options
  • Save derozic/3f68302d1299094927d753356f58325f to your computer and use it in GitHub Desktop.
Save derozic/3f68302d1299094927d753356f58325f to your computer and use it in GitHub Desktop.
Generate keypair, add to MacOS Keychain, Copy to the Clipboard
@derozic
Copy link
Author

derozic commented May 1, 2018

Create the keypair, choosing a new passphrase when you do:

ssh-keygen -t rsa -f ~/.ssh/id_rsa

Add the newly minted private key to your MacOS Keychain to store the passphrase and manage unlocking it automagically:

ssh-add -K ~/.ssh/id_rsa

Copy the public key to the clipboard for getting busy with web services like GitHub, etc.

cat ~/.ssh/id_rsa.pub | pbcopy

Add your newly minted public key to the ~/.ssh/authorized_keys file of the remote server with correct permissions of both the remote ~/.ssh folder (700) and ~/.ssh/authorized_keys (600). W0rd.

@derozic
Copy link
Author

derozic commented May 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment