Skip to content

Instantly share code, notes, and snippets.

@ophentis
Created April 27, 2013 15:16
Show Gist options
  • Save ophentis/5473449 to your computer and use it in GitHub Desktop.
Save ophentis/5473449 to your computer and use it in GitHub Desktop.
setting multiple private key for ssh
1.
ssh-keygen -t rsa -f ~/.ssh/id_rsa.work -C "Key for Word stuff"
2.
touch ~/.ssh/config
chmod 600 ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.work" >> ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.misc" >> ~/.ssh/config
3. more detailed config (default to ~/.ssh/id_dsa or ~/.ssh/id_rsa if no match)
Host *.home
IdentityFile ~/.ssh/id_dsa.home
User king123
Host *.vpn
IdentityFile ~/.ssh/id_rsa.work
User yaya
Port 2222
Host *.vm
IdentityFile ~/.ssh/id_rsa.vm
User whatisup
Port 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment