Skip to content

Guide: Connecting to a Supercomputer from Windows

This guide will focus on establishing a secure connection via ssh using Openssh. If you prefer to use Putty, you will need to install their client. It is not advised since the public OpenSSH key comes in a slightly different format than the one accepted by the SuperComputer. If you want to skip additional info, pleae jump to the "Generating SSH Keys with OpenSSH" section.

Introduction to SSH

SSH (Secure Shell) is a protocol for securely accessing a remote shell over a network. It uses asymetric cryptographic keys to secure the connection, ensuring that communications remain private. For a computer to securely connect to a server, the computer needs to hold a private key, and the server the associated public key. We will send to the SuperComputer our public key and IP. The private key path will be only used in our config file. Do not share your private key.

Additionnaly, if you also need to access the files on your distant computer, you can use SCP or SFTP to connect securely and transfer files. Most Servers that have ssh will also accept scp/sftp connections. We strongly advice to install WinSCP for that matter.

Small tip:

Info

The WinSCP software is extremely well designed and intuitive. For HPC beginners, it also makes it easy to navigate through the supercomputer's folders and files so you can understand its structure and architecture. This is a good way to grasp where to save code files and data/datasets. Think of it as a remote explorer, allowing you to transfer files to the SuperComputer.

PuTTY or OpenSSH.

The two common tools for SSH connections under windows are PuTTY and OpenSSH.

PuTTY is a popular SSH client for Windows, offering a graphical interface. I also comes with a key generator and its associated key agent.

OpenSSH is a suite of SSH tools integrated into many posix systems, including Linux and macOS, and it's available for Windows too.

  • Each tool produces keys in a different format. If you only uses the same suite of tools, there is no problem.

So, different formats, and the SSH server we want to connect to only supports the OpenSSH format. That is why, if you want to use PuTTY, you will need to export the private key as OpenSSH format. The public key using PuTTY is not in the keygen OpenSSH public key format.

Prerequisites

  • Windows 10 or newer for OpenSSH compatibility.
  • Visual Studio Code installed with the Remote - SSH extension for connecting via OpenSSH.
  • PuTTY and PuTTYgen installed for key generation and SSH (if using PuTTY).

Generating SSH Keys with OpenSSH

  1. Launch PowerShell:

    • Start the program and prepare to generate a new SSH key pair.
  2. Generate Key Pair:

    • Please insert this in the temrinal window: "ssh-keygen -a 100 -t ed25519 -f ~/.ssh/id_ed25519"
    • Here it is assumed that you have an .ssh folder, change the path if needed. You just have to remember where you generated the key.
  3. Verify Keys:

    • Go to the folder where the keys were generated.
    • Private Key: You can open the private key file (right click, open with notepad). It should look like this:

      ssh button

    • Public Key for OpenSSH: Open the file, it should look like this: "ssh-ed25519 OOPAC3NzaC1lMDI1NDD5AAAAIOpEi0ieVw39Fo/bDBSbee3FcFHfKAzKCLECwinFQ+gyfD alban@DESKTOP-3KTU7GR" It should have your computer user at the end. This is no the case if you generate the key with PuTTYgen. Copy the content of your public key. You will need it in the next step.

  4. Prepare the Public Key for the Server:

    • Access JuDoor (where you can manage your ssh connections, amon other things) and upload the openssh formatted public key file giving your IP. To do so, please follow this guide. You might need to wait a few minutes before trying to connect to the SuperComputer (either from terminal, PuTTY or VScode). Creating your "from..." query will be the only moment you'll need the public key.

Generating SSH Keys with PuTTYgen (skip this if already done)

Advised not to, takes more time. If you want to, make sure to add the computer user at the end of the public key. 1. Launch PuTTYgen: - Start the program and prepare to generate a new SSH key pair.

  1. Key Type Selection:

    • Select the EdDSA key type with a 255-bit size for optimal compatibility and security. No other format will work with the SSH server.
  2. Generate Key Pair:

    • Click on the "Generate" button and follow the instructions to create the key pair. Typically, this involves moving your mouse over the window to generate randomness.
  3. Save Keys:

    • Private Key: Click "Save private key" to save your private key to a secure location. Choose a directory X for storage.
    • Public Key for OpenSSH: PuTTYgen displays a field titled "Public key for pasting into OpenSSH authorized_keys file". Copy this content. Add your user at the end.
    • Create a new file named mypublickey (the .openssh extension is optional and for your reference only) in directory X and paste the copied public key content into this file.
  4. Prepare the Public Key for the Server:

    • Access JuDoor (the ssh management website) and upload the .openssh formatted public key file. To do so, please follow this guide. You might need to wait a few minutes before trying to connect to the SuperComputer (either from terminal, PuTTY or VScode).

Configuring SSH Connection

Using PuTTY (Optional)

If you prefer to test the connection with PuTTY:

  • Navigate to Connection -> SSH -> Auth in the PuTTY configuration menu and load your private key file (.ppk format).

However, this guide focuses on connecting via Visual Studio Code and OpenSSH.

Using OpenSSH with Visual Studio Code

  1. Install Remote - SSH Extension in VS Code:

    • Open VS Code, go to Extensions, and search for "Remote - SSH". Install the extension. A computer icon should appear on the left.
  2. Configure SSH:

    • We will now create a new SSH configuration file. You can start with a template similar to the one in the tutorial you just followed (scroll to the end and copy the content).
    • Create a config file. Right click on your keys folder and create a file named config. No need for a format("config" instead of "config.txt"). Store the config in .ssh directory under your user profile (e.g., C:/Users/myuser/.ssh/config).
  3. Edit the Config File:

    • Open it, it should look like this. If not please copy the following text:

      Host booster
              HostName juwels-booster.fz-juelich.de
              User USERNAME   
              AddressFamily inet
              IdentityFile C:/Users/me/.ssh/id_ed25519-JSC.openssh
          MACs hmac-sha2-512-etm@openssh.com
      
      Of course, you have to edit "USERNAME" and put your judoor username. Same thing goes for the path of your OpenSSH key. The configuration file must point to the OpenSSH private key file(copy and paste path if no in the same folder).

      This config file is for booster. But you can change the partition.

  4. Setup in VS Code:

    • In settings (ctrl+shift+p, type Remote-SSH: Open SSH configuration file... and add a config file), specify the path to your edited config file (e.g., C:/Users/myuser/.ssh/config).

    • With the Remote - SSH extension installed, click on the blue SSH button at the bottom left, then "Connect to Host". Click on the config file.

      ssh button
      Click here.

  5. Permissions Check:

    • Ensure the OpenSSH key file has correct permissions: it HAS TO be accessible by your user ONLY. Right-click the file, go to Properties -> Security -> Advanced -> Deactivate heritage and adjust permissions as needed. Remove any users that are not you and ensure your user has full access. You want to end up with system, admin and you having permissions on the file with the heritage being deactivated.
  6. Connect:

    • After configuring permissions, attempt to connect via VS Code. You should see on the left a new extension icon. Click the remote extension and try to click on the little arrow to connect yourself to the login node of the SuperComputer partition you chose. If any errors arise, verify the permissions and configuration settings.

Troubleshooting

If you encounter connection issues in VS Code, check the following:

  • The SSH private key permissions are correctly set.
  • The SSH configuration file points to the correct private key and remote host details.
  • Your keys look like mine (not exactly like mine please).
  • The "from.." query you uploaded in the judoor webpage is correct. Check the IP (should be ipv4) you gave. If you are connected to a public network (such as eduroam), try giving your private IP instead.
  • The config file path is correct.
  • The config file is correct (good username and good private key path).

Following these steps should enable you to successfully connect to the SuperComputer from a Windows environment using SSH. If you have a question or a remark regarding this recipe, please fill free to reach at "albanlinchet7@gmail.com". Any feedback is welcome.

Thanks for following this recipe!