Managing Multiple SSH Keys Through Command Line


Managing Multiple SSH Keys is becoming more and more important these days due to the PaaS instances and less costly IaaS. Here is how to manage multiple Keys. Plus as most of us needs to use GitHub like repositories, more and more separate identities are becoming a standard need. In this guide we will show the process for Managing Multiple SSH Keys.

 

Managing Multiple SSH Keys : Preface

 

We will be use Git as remote (although that part is not needed here) and OS X 10.8.2 with iTerm2 and oh-my-zsh as shell (not bash). Commands will be almost same for Linux. The required for iTerm2 on OS X 10.8.2 was written before.

Normally, a single default identity is created for the first time usage and those set appear as id_big-value and id_big-value.pub; where big-value is rsa or dsa. This pair is used for all identification, which might not be relevant (as you will add more and more profiles) later or you want the things to be organized properly. This is why we are taking the pain to create a config file for Managing Multiple SSH Keys.

 

Managing Multiple SSH Keys : Method

 

The steps are almost same for Ubuntu and Debian OS, but specifically this is for full OS X Server administration (read Mac OS X 10.8).

 

First change directory to .ssh :

 

cd ~/.ssh

 

This is very nice command, you will get a 1024 bit key pair (public and private keys) with no password prompts and many extra things :


 

ssh-keygen -b 1024 -t dsa -f id_dsa -P ''

 

If you want 2048 bits, change from 1024. ssh obtains configuration data from the following sources in the following order : command-line options, user’s configuration file ($HOME/.ssh/config), system-wide configuration file (/etc/ssh/ssh_config ).

As the next steps, you will :

 

Managing Multiple SSH Keys Through Command Line

 

touch authorized_keys2
cat id_dsa.pub >> authorized_keys2

 

chmod 400 id_dsa

 

 

And finally add for your needed service / git :

 

service-name keys:add

 

As in case of the screnshot, you can see, we got two options to choose from. So this needs to be done first before login to the service.

Abhishek-Ghosh


Incoming search terms:

mac os manging ssh keys,ssh keys,iterm2 and ssh key,iterm2 ssh keys,managing multiple ssh keys,multiple ssh keys,multiple ssh keys -i,ssh command multiple lines
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
About Abhishek

Abhishek Ghosh is an Orthopedic Surgeon, Inventor with 216 Patents, Current editor of The Customize Windows Media Group. You can follow and know more about Dr. +Abhishek Ghosh on Google Plus and follow on Twitter as @AbhishekCTRL.

Trackbacks

  1. Managing Multiple SSH Keys Through Command Line says:

    [...] Managing Multiple SSH Keys Through Command Line [...]

Speak Your Mind

*