Difference between revisions of "SSH on Windows"

From Storrs HPC Wiki
Jump to: navigation, search
(Document connecting with authorized_keys.)
(Fix broken list.)
Line 41: Line 41:
 
Now let's copy the public key to the cluster to allow auto-login.
 
Now let's copy the public key to the cluster to allow auto-login.
  
# Go to your PuTTY window from your last session where you are logged into the cluster.
+
# Go to your PuTTY window from your last session where you are logged into the cluster. If you don't see see <code>[<NetID>@cn65 ~]$</code> then make sure you followed the previous steps to login using PuTTY. In the PuTTy window:
If you don't see see <code>[<NetID>@cn65 ~]$</code> then make sure you followed the previous steps to login using PuTTY.
 
In the PuTTy window:
 
 
## Copy the line below from this wiki:
 
## Copy the line below from this wiki:
 
##: <code>nano ~/.ssh/authorized_keys</code>
 
##: <code>nano ~/.ssh/authorized_keys</code>

Revision as of 16:02, 7 January 2016

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, just enter the "Host Name" as shown below, and replace "NetID" with your own. PuTTY-Settings.png

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 ("login3" in the screenshot) 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. PuTTY-Warnings.png

Now you will see a black terminal with your Net ID, prompting for your password. Type your UConn password to log in to the cluster. 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.

  1. Run puttygen.exe and click on the "Generate" buton
  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"
  5. 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".
  6. Leave the PuTTY Key Generator window open! We will use it later on.

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.

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 "login3" 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 "login3" 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.