Menu
abriraqui
  • reflexiones
  • publicaciones
  • hackership
  • experiencias
abriraqui

Handeling different ssh keys

Posted on September 25, 2013

Tweet

I don’t like to hawoman indicating ssh ve several of anything, because at the end I always get mixed up (yes, everyday I mixed all my different passwords, I never remember which one I have to use).
So having several ssh keys was not something that I wanted to have, but for X reason it just happened and I have to handle with it.

So thanks to Christophe, he told be how to configure my ssh file so that I could have manage several keys without pain 🙂

The thing is create on you home directory, under .ssh folder a config file

➜  ~  touch .ssh/config

Then you can edit the file and insert the following lines

 

Host heroku.com
IdentityFile ~/.ssh/my_public_key
IdentityFile ~/.ssh/my_second_public_key
IdentitiesOnly yes

Host github.com
IdentityFile ~/.ssh/my_public_key
IdentitiesOnly yes

As you can see, you need to specify for each server which key or keys you are using, so that when it tries to connect the server will just find out which one is the valid one 🙂

©2023 abriraqui | Powered by SuperbThemes & WordPress