UND HPC Tutorial - Using SSH Keys to Login

UND Computational Research Center


Here is some basic information on how to connect to the UND HPC Linux clusters and login using ssh keys. In this example we will be using Talon.


Your Talon Account

If you do not already have an account on one of the clusters, you will need to get request an account. To do this you will need to submit a request using the request form Here.

This tutorial assumes you are able to login to the cluster using your password.


Software

If you are on Windows you will need to install a program to generate and use the keys. We recommend using the putty packages (puttygen and pagent). These should be included with a regular install of putty, otherwise they are located at https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.

Linux and mac users do not need to install any additional programs.


Generating keys

Windows

  1. Once you have puttygen installed open it up and you should be greeted with the following screen.

    pgen1

  2. Click Generate.

    • It will have you move your mouse around randomly. Do this until the green bar is completely filled.

      pgen2

  3. Once it has generated your new key change the key comment to something like first.last, add a passphrase in the passphrase boxes and click the save buttons ("Save public key" and "Save private key") saving to a location on your hard drive that you will remember.

  4. These files are your Public and Private keys.

    • The private key will have a .ppk extension
    • NOTE: Never share your Private key with anyone

      pgen3

Linux and Mac

  1. Open your terminal.

  2. Run the following command

     ssh-keygen -t rsa -C "first.last"
    
  3. Press Enter to save the keys to the default location

  4. Enter a new password two times

    linux

  5. After the confirmation screen you should now have two files

    • Private key: id_rsa
      • NOTE: Never share this with anyone
    • Public key: id_rsa.pub

Importing the key

  1. Open your public key. It should have the format as follows:

    ssh-rsa <Long key string>==first.last
    
    • On Linux and mac this should be how it is formatted

    • On Windows

      • If you copy from the puttygen window it will be in this format.
      • If you are copying from the public key you will need to do some formatting to put it all on one line
  1. Copy the key string

  2. Login to the cluster you are trying to use and open ~/.ssh/authorized_keys

  3. Paste in your key and save the file.


Logging in

On Linux and mac you should be all setup. To login just use your normal ssh commands and enter the password for your ssh key when prompted

On Windows you will need to load the key with pagent.

  1. Start Pagent. It will show up in your icons on the task bar.

    pagent 1

  2. Right click the icon and select add view keys

    pagent 2

  3. Click Add key and open the key that you saved earlier.

    • It will ask for the password and then show up in the list of keys.
  1. You should now be able to use your normal putty session to login to the cluster.

results matching ""

    No results matching ""