Configuring SSH Keys on Linux and Mac OS X

Linux and Mac OS X both come with support for SSH and SSH keys out of the box. Launchpad uses SSH keys to authenticate your computer with your Launchpad account. This guide shows you how to get that done.

SSH Keys
The first thing you need to do is generate your SSH keypair. A keypair, as the name implies, consists of 2 parts: the public key and the private key.

Public Key
Your public key is placed on remote servers so that they can check back with you to see that you are who you say you are.

Private Key
Your private key should NEVER leave your computer! This is the main file that authenticates you. It contains the special unique data that identifies you.

Generating a Keypair
Generating a keypair is very easy.


 * 1) Open a terminal
 * 2) Type in the following: $ ssh-keygen -t dsa
 * 3) Accept the defaults, to save your public and private keys to ~/.ssh
 * 4) Open your public key (~/.ssh/id_dsa.pub) in a text editor (GEdit or Kate on Linux, TextEdit on Mac OS X)

Launchpad & SSH
Like I said before, when you use Launchpad and Bazaar, it likes to use the SSH keys to authenticate you. We need to add our public key to Launchpad.

Adding Your Public Key to Launchpad

 * 1) Open your browser to Launchpad and log in
 * 2) Go to your home page and click on the Change details link
 * 3) Click on the SSH Keys tab (Note: Not the OpenPGP keys!)
 * 4) Paste that public key into the text box at the bottom of the page
 * 5) Click the Import Public Key button at the bottom of the page

And you're done!

More In Depth Example
This is specific to Mac OS X 10.6, but should be similar on any Mac or Linux system.


 * 1) Open Terminal
 * 2) Change to hidden SSH folder $ cd ~/.ssh/
 * 3) Generate a key ssh-keygen -t dsa Prompts for above are as follows, just hit enter for the file name, and then enter the password twice and you are done.
 * 4) Enter file in which to save the key (/Users/brianmeyerdesign/.ssh/id_dsa): [Just Hit Enter]
 * 5) Enter passphrase (empty for no passphrase): [Enter a unique password]
 * 6) Enter same passphrase again: [Renter a unique password]
 * 7) Make sure you remember your password you enter
 * 8) Now you should have 2 new files in your folder, named id_dsa and id_dsa.pub which are your private and public keys respectively.
 * 9) Set permissions on the keys you just created to be as restrictive as possible. chmod 400 id_dsa.*
 * 10) Modify the SSH config file to automatically use your just created key every time you connect to launchpad
 * 11) Use your choice of text editor to edit ~/.ssh/config
 * 12) sudo vi config
 * 13) Hit i to enter insert mode
 * 14) Add the following text to the bottom, where it says yourlaunchpdusername replace with your launchpad user name. ( to get yourlaunchpdusername visit https://launchpad.net/~ and it will redirect to add your username to the url after the ~ ) Host bazaar.launchpad.net&#10;&#13;IdentityFile ~/.ssh/id_dsa&#10;&#13;User yourlaunchpdusername
 * 15) Hit Escape
 * 16) Hit ZZ
 * 17) Copy the contents of your public key file on the Mac cat ~/.ssh/id_dsa.pub | pbcopy Linux users or Mac users can alternatively open ~/.ssh/id_dsa.pub with your favorite text editor or omit pbcopy and just copy it after running the command cat ~/.ssh/id_dsa.pub.
 * 18) Finally Edit your SSH keys on launchpad as described in Adding Your Public Key to Launchpad above. ( you can click on https://launchpad.net/people/+me/+editsshkeys which will take you directly to the page to update your SSH keys on launchpad ). Make sure you are on SSH keys and not PGP keys here.