SSH on Windows

From Storrs HPC Wiki
Jump to: navigation, search

Overview

Windows does not come with a built-in SSH client. However you can download PuTTY for free. A very useful feature of PuTTY is it does not need to be installed, which allows it to be used on machines without administrative access. Simply run the putty.exe file.

Usage

To connect to the cluster, open putty and set your host name as NetID@login.storrs.hpc.uconn.edu. For example, "abc12345@login.storrs.hpc.uconn.edu".

Putty with a basic configuration.

To save you from having to enter this "Host Name" line the next time you run PuTTY, type any name into the "Saved Sessions" box and click the "Save" button. Then when you next open PuTTY, just double click on the saved session in the list (under Default) to open the connection with your saved settings.

Also, the first time you connect, you will see a warning about the server's fingerprint. Click "Yes" to accept the server's public key.

Now you will see a black terminal with your Net ID, prompting for your password. Type your Net ID (not engineering ID) password to log in to the cluster. *Note* Typing the password will NOT show the "*" symbols that is usually seen from a Windows terminal. That's it! Continue reading to automate your login to the cluster.

Login with SSH keys

We recommend generating SSH keys to save yourself time entering your NetID and password, not only for PuTTy, but for all of your OpenSSH aware programs. Download PuTTY gen to generate the keys.

Create key pair using PuTTY Key Generator

Puttygen initial page
  1. Run puttygen.exe and click on the "Generate" button
  2. After you move the mouse around to generate randomness and he green bar moves to completion, it will prompt for a Key passphrase. You can leave it blank.
  3. Click "Save public key" and then create the standard .ssh folder:
    1. Press the Ctrl+L keys to select the top location bar.
    2. Press Ctrl+A and then Backspace to clear the current folder name.
    3. Type %HOMEPATH% in that location bar and hit Enter.
    4. Click the "New folder" button and type .ssh. and hit Enter (yes, you need the extra dot at the end).
    5. Double-click on the new ".ssh" folder and save your public key as id_rsa.pub
  4. Click "Save private key" and click "Yes" to ignore the warning about saving the key without a passphrase.
    1. Type id_rsa.ppk and "Save"
How to export your openssh key
  1. Click Conversions > Export OpenSSH key and click "Yes" to ignore the warning about saving the key without a passphrase.
    1. Type id_rsa and "Save".
  2. Leave the PuTTY Key Generator window open! We will use it later on.

Copy the public key to the cluster

Now let's copy the public key to the cluster to allow auto-login.

  1. Go to your PuTTY window from your last session where you are logged into the cluster. If you don't see see [<NetID>@cn65 ~]$ then make sure you followed the previous steps to login using PuTTY. In the PuTTy window:
    1. Copy the line below from this wiki:
      nano ~/.ssh/authorized_keys
    2. Right click anywhere inside of your PuTTy window to paste, and then to run the command press Enter. This opens authorized_keys inside of the editor "nano".
    3. It's possible your file is empty, or you may see some "ssh-rsa ..." lines. If you have some of those "ssh-rsa ..." lines, press Alt+/ to move to the last line of the file. If your cursor is not at the beginning of a new line, press Enter to create a new line.
  2. Go back to your still open PuTTy Key Generator window and click inside of the scrolling window where it says "Public key for pasting into OpenSSH authorized_keys file"
    1. Press Ctrl+HOME then Ctrl+SHIFT+END and right-click > Copy.
    2. To paste in the cluster window, just right-click again in the cluster window.
    3. In the cluster window, save the file with Ctrl+O Enter Ctrl+X
  3. Close the cluster window and choose OK to close the session.





How to save your private key for putty to use

Tell PuTTy to use the private key

Now that the cluster knows to allow our key, we just have to tell PuTTy to use the key during login.

  1. Open PuTTy again: choose your Saved "login" Session on the main screen and click "Load".
    1. Double-click on SSH in the left-side menu.
    2. Click on Auth
    3. Browse for the private key. Putty should automagically open to the .ssh folder in your home directory, where you can choose your new id_rsa.ppk file
  2. To save your session, in the left side window scroll to the top and click on Session, choose "login" and click "Save".
  3. Test that it works by clicking "Open" and you should automatically be logged in without having to type your password!

Next Steps

You can continue reading about submitting jobs from the SLURM Guide and the HPC Software Guides.