Creating and using a public/private SSH keypair

(For accessing the BIOS virtual machine in the SURFsara HPC Cloud.)

Creating a keypair on Linux or Mac OSX

  1. Generate a public/private keypair

If you have files named ~/.ssh/id_rsa and ~/.ssh/ you're fine. Proceed to step 2.

If not, type the following command in ~/.ssh/ :

ssh-keygen -t rsa -C ''

This will ask for a passphrase (twice). Although you could leave it empty, we advise to use a passphrase. See the instructions from GitHub for more info.

  1. Send your public key to the server maintainer

Your public key is in the file ~/.ssh/ Send it by email as an attachment to Leon Mei (h.mei[at] . Proceed to step 3 after you got a confirmation.

  1. Login to the VM

For accessing the VM, you need your private key. It is in the file ~/.ssh/id_rsa and you should never share it. SSH will automatically find it.

To login to the VM, type the following command (you might be asked to type the passphrase for your private key):


Creating a keypair on Windows

(Instructions borrowed from Joyent.)

  1. Download and open the PuTTYgen program.
  2. For Type of key to generate, select SSH-2 RSA.
  3. Click the Generate button.
  4. Move your mouse in the area below the progress bar (note that moving the mouse is actually necessary, as it generates a amount of randomness in the keys). When the progress bar is full, PuTTYgen generates your key pair.
  5. Type a passphrase in the Key passphrase field. Type the same passphrase in the Confirm passphrase field. You can use a key without a passphrase, but this is not recommended.
  6. Click the Save private key button to save the private key. You must save the private key. You will need it to connect to your machine.
  7. Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys file and choose Select All. Right-click again in the same text field and choose Copy.
  8. Send an email to the server maintainer with copied content pasted into it.

Note: This method did not seem to work reliably for all of us, so you might want to create a keypair on a Linux or Mac OSX machine instead and copy it to your Windows machine.

Login to the VM from Windows using Putty

  1. Download and open the PuTTY program.
  2. Enter in the "Host Name" field.
  3. On the left, navigate to category "Connection/SSH/Auth".
  4. Click the "Browse" button and select your private key.
  5. Click the "Open" button to open the connection.
  6. First time, you will be asked to accept the server's signature (do so).
  7. You will be asked for your username.



Last modified 5 years ago Last modified on Sep 22, 2016 3:46:27 PM

Attachments (5)

Download all attachments as: .zip