Generate an SSH key pair

This article explains how to create an SSH key pair for logging in to JASMIN. It covers:

  • The shell terminal
  • Using ssh-keygen to create an SSH key pair
  • Converting a PuTTYGen private key for use with MobaXterm (Windows only)

The shell terminal

Generating an SSH key pair requires an SSH client and a Shell terminal. Linux and Mac users can use a standard terminal which is very likely to have SSH installed. Windows users are advised to  install the MobaXterm application which provides a linux-style terminal with all the relevant utilities included. Figures 1 and 2 show example terminal windows on a Mac and Windows (using MobaXterm).

Mac terminal

Figure 1. Screenshot of a shell terminal on a Mac.

Figure 2. Screenshot of a shell terminal using the MobaXterm client on Windows.

Using ssh-keygen to create an SSH key pair

The   ssh-keygen command should be used in order to generate your SSH key pair. Open a terminal and generate your public and private key, as follows (replace the e-mail address with your own):

$ ssh-keygen -t rsa -b 2048 -C "" -f ~/.ssh/id_rsa_jasmin

At the prompt, type a secure passphrase to protect your SSH private key. This is a requirement for access to JASMIN machines. The output will look something like this:

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): <ADD PASSPHRASE HERE>
Enter same passphrase again: <REPEAT PASSPHRASE HERE>
Your identification has been saved in /home/users/meuser/.ssh/id_rsa_jasmin.
Your public key has been saved in /home/users/meuser/.ssh/
The key fingerprint is:

Running  ssh-keygen will generate two files in your  $HOME/.ssh/ directory:

  • id_rsa_jasmin - the private key file (which should have permission "400", i.e. readable only by you)
  • - the public key file

The public key file is the part that you need to share in order to access JASMIN. The private key file should be protected and not shared with others.

Converting a PuTTYGen SSH private key for use with MobaXterm (Windows only)

If you have previously used the  PuTTY utilities to login to JASMIN and you wish to move over to using MobaXterm then please see these instructions to convert your SSH private key from the PuTTYGen format to the OpenSSH format (as used by Linux/Mac). Please save your resulting OpenSSH key as id_rsa_jasmin in your  $HOME/.ssh/ directory.

Still need help? Contact Us Contact Us