How to generate and use an SSH keypair with Triton

Whether you're on Linux / OS X / Unix or Windows, you'll have to create an SSH RSA keypair. This allows you to securely authenticate with the SDSC computers.

When you've generated the keypair, send only the public key for account application.

If you generate a key on one system and want to use it on the other, you will have to convert it.


Linux / OS X / Unix key generation

All commands are in bold. Comments are in italics and should not be typed into your console.

[hnielsen@dilbert:~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/cs/student/hnielsen/.ssh/id_rsa): Hit enter here - the default location is fine
Enter passphrase (empty for no passphrase): Your choice - it protects your private key if it gets copied
Enter same passphrase again:
Your identification has been saved in /cs/student/hnielsen/.ssh/id_rsa.
Your public key has been saved in /cs/student/hnielsen/.ssh/id_rsa.pub.
The key fingerprint is:
b5:46:00:aa:0a:54:1b:ca:cc:12:48:6a:92:c4:ad:3a hnielsen@dilbert.cs.ucsb.edu
The key's randomart image is:
+--[ RSA 2048]----+
|=o.o  ...        |
|B+o.o.   .       |
|=B...     o      |
|=. .     o .     |
|o .     S o      |
|E.       .       |
|..               |
|                 |
|                 |
+-----------------+
[hnielsen@dilbert:~]$ cat ~/.ssh/id_rsa.pub This is your public key,
 which is sent for account application  
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAo/faKHFurT7DE43ZbA0DDh24I0jywQQnXCbfdDf8dFE3981MTMYovOGTSEvFzLwLBRr4JUMcN/6+66IySeHuzptuFrdtDJw7i3m4wO3VaXWq3t+e/LKRmG03sCnNxtDvMnAGKjW4BxwBQ7xXtmRAeQt6YK0HAC2PuHEa+jO684gea+YKtAkFGOesEz5Vivjxd7XJ/8MyPrO7lATxb3ez6BqZmyhLgg89MNvZJ/i5iKUxdMh4ss5jLh5SgHtv6e+7+Gk0dXnv+d418+dGejOp43msv5CeWJn8vyoOBixhdc7FGUJIjDvJ+A1wGr2+p2tw8b6ZsoYxZbM981UKIFXuaw== hnielsen@dilbert.cs.ucsb.edu
[hnielsen@dilbert:~]$

Take the public key and paste it into an email for account application. Your private key is in "~/.ssh/id_rsa" - this is what you will need later to log on to Triton.


Windows key generation

Get a copy of the PuTTY Windows installer from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Install however you see fit.

Run PuTTYgen. You should see a window that looks like this:

Select "Generate" and wiggle your mouse until PuTTYgen is happy. The window will now look like this:

Add a passphrase if you want.

Save your private key by clicking "Save private key". This will save your private key in a PuTTY key file. If you want to use this on Linux / CSIL / OS X / Unix, you will have to convert the key.

The section titled "Public key for pasting..." contains your public key (which looks like "ssh-rsa AAAAB3Nz..."). This needs to be sent for account application.


Conversion of OpenSSH key format on Linux / OS X / Unix to PuTTY key format on Windows

Follow the installation instructions for PuTTY from the Windows key generation section.

Copy the ~/.ssh/id_rsa file from the system you generated your key to your local system. I usually use WinSCP to do this.

Run PuTTYgen.

In the "Conversions" menu, select "Import key". Select the id_rsa file you copied with WinSCP.

PuTTYgen should now show you your imported OpenSSH key. Select "Save private key" to save your key in the PuTTY key format.


Conversion of PuTTY key format on Windows to OpenSSH key format on Linux / OS X / Unix

First, load your private key into PuTTYgen.

In the "Conversions" menu, select "Export OpenSSH key". Save the file as "id_rsa", or something else if you desire.

Once you've exported your key, upload it to the Linux / OS X / Unix system you wish to use. I usually use WinSCP to do this.

Your file should be placed in the .ssh directory in your home directory. The full path should look something like ~/.ssh/id_rsa.

by Hans Nielsen. 2010