Skip to content

Instantly share code, notes, and snippets.

@HansCz
Created April 13, 2012 17:06
Show Gist options
  • Save HansCz/2378396 to your computer and use it in GitHub Desktop.
Save HansCz/2378396 to your computer and use it in GitHub Desktop.
SSH (Bash) - adding key to ssh-agent
# Linux
eval `ssh-agent`
ssh-add ~/.ssh/some_key_rsa
ssh user@server
# Mac
## As of the Leopard release of OS X, ssh-agent is more tightly integrated with Keychain. It is possible to store the passphrases of all of your SSH keys securely in Keychain, from which ssh-agent will read them on startup. The bottom line is that it is simple to secure your keys with passphrases, but never have to type the passphrase to use them! Here is how:
## Add the pass phrase to each ssh key to keychain:
ssh-add -K [path/to/private SSH key]
## Whenever you reboot your Mac, all the SSH keys in your keychain will be automatically loaded. You should be able to see the keys in the Keychain Access app, as well as from the command line via:
ssh-add -l
@cgi1
Copy link

cgi1 commented May 15, 2019

I was not aware of this in Mac OSX - Thank you!

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