Skip to content

Instantly share code, notes, and snippets.

@mrgcohen
Last active December 21, 2015 01:28
Show Gist options
  • Save mrgcohen/6227787 to your computer and use it in GitHub Desktop.
Save mrgcohen/6227787 to your computer and use it in GitHub Desktop.
authorized keys linux...how have i not been doing this more ...also i love ssh-agent

[ Dana = Local Machine ]
[ Michael = remote machine ]

  1. cd into home .ssh directory on Dana
cd ~/.ssh
  1. On Dana Create a keypair and include a passphrase (we can have apple keychain save it and never have to remember it... thanks ssh-agent)
ssh-keygen -t rsa -C "key for blablabla"

By default it will create "id_rsa" and "id_rsa.pub"

  1. Append *.pub created to ~/.ssh/authorized_keys on Michael
ssh user@michael
scp id_rsa.pub ~/.ssh/authorized_keys
  1. On Dana modify the config file
vi ~/.ssh/config
Host dana
Hostname dana.box.com
User username
IdentityFile ~/.ssh/id_rsa
  1. Now SSH in and it should ask you to save your passphrase to your keychain. You can now use the Host specified in the config file
ssh dana
  1. You're done, now you are using the key with your passphrase everytime but never need to remember it. Your computer will save it securely for you.

:-)

@mrgcohen
Copy link
Author

😄
🌴

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