HPC Beta - Logo
Dashdark X Webflow Template - Icon
Overview
Getting Started
Core Concepts
Data Storage
Cluster Control
Snapshot
Guide
Convergence plot
File tailing
Use SSH
Whitelist / blacklist
Launch a simulation
Tutorials
OpenFOAM Motorbike
StarCCM+ on Qarnot HPC
Data and Licenses
Configure IP Whitelisting and Port Forwarding to allow Qarnot to access to your self-hosted licenses
Configuring your licence server to use it with Qarnot
Manage your data using rclone cli
Manage your data with a dedicated UI
Essayez dès maintenant !
HPC Beta - Logo

Introduction

Secure Shell (SSH) keys are a pair of cryptographic keys used to authenticate a user on remote systems securely. They enhance security by eliminating the need for password-based logins, making unauthorized access more challenging. This tutorial will guide you through the process of creating and using SSH keys on both Windows and Linux systems, with a focus on using PuTTY for Windows users.

Prerequisites

Before we begin, ensure you have the following:

  • For Windows Users:
    • PuTTY and PuTTYgen installed. You can download them from the official PuTTY website.
  • For Linux Users:
    • Access to the terminal with ssh-keygen installed (commonly pre-installed on most distributions).

Step-by-Step Instructions

Generating SSH Keys on Linux

  1. Open the Terminal
    • Locate and open the terminal application on your Linux system.‍
  2. Generate the SSH Key Pair:

Type the following command and press Enter:

ssh-keygen -t rsa -b 2048

  • -t rsa specifies the RSA algorithm.
  • -b 2048 sets the key length to 2048 bits.
  1. Specify the File Location:

When prompted with:

  • Enter file in which to save the key (/home/yourusername/.ssh/id_rsa):
  • Press Enter to accept the default location or specify a different path if desired.
  1. Set a Passphrase
  • You'll be prompted to enter a passphrase:
    • Enter passphrase (empty for no passphrase):
      • It's recommended to set a passphrase for added security. Type your passphrase and press Enter. You'll need to confirm it by typing it again.
  1. Completion:

Upon success, you'll see a message similar to:

  • Your identification has been saved in /home/yourusername/.ssh/id_rsa.
  • Your public key has been saved in /home/yourusername/.ssh/id_rsa.pub.

Generating SSH Keys on Windows Using PuTTY

  1. Install PuTTY and PuTTYgen:
    • Download and install the PuTTY package from the official website. Ensure both PuTTY and PuTTYgen are installed.
  2. Open PuTTYgen:
    • Locate and open puttygen.exe.
  3. Configure Key Parameters
    • In the PuTTY Key Generator window:
      • Ensure RSA is selected.
      • Set the number of bits to 2048.
  1. Generate the Key:
    • Click the "Generate" button.
    • Move your mouse randomly within the window to provide entropy until the progress bar completes.
  1. Save the Keys:
    • Once generated:
      • Private Key: Click "Save private key". Choose a secure location and save the file with a .ppk extension.
      • Public Key: Select and copy the text in the "Public key for pasting into OpenSSH authorized_keys file" box. Save this text to a file named id_rsa.pub or similar.
  1. Set a Passphrase:
    • For added security, set a passphrase when saving the private key (this is optional).

Using SSH Keys to Connect to Your Cluster

After generating your SSH keys, you can connect to your cloud HPC cluster to manage your simulation.

1. During the simulation set up 

  1. To use SSH, you must select a SSH-compatible profile. Those will often have the explicit “ssh” mention in their name. 
  2. Provide the public key in the designated field of the form.
    1. Note: the public key should look like “ssh-rsa AAAABBBBEEEE333EZEZ …. “

2. Get the SSH Command:

  • Once your simulation is running, navigate to the SSH quick access tab in the monitoring features. (be carreful it may require some times before the ssh information connexion is displaed)
  • Copy the provided SSH command, which will be in the following format:
 ssh -p {port number} root@forward01.qarnot.net
  • The {port number} will be automatically filled with your simulation’s exposed port.

3. Execute the SSH Command

Using linux or windows terminal
  1. Open your terminal and run the copied SSH command.
  2. This will establish a secure connection to your cluster, granting you root access.
  3. Verify Your Connection:
    1. Once connected, you should see a prompt indicating you are now inside your cluster environment.
    2. You can now manage your simulations, execute commands, and perform system configurations as needed.
Using Putty
  • Open putty.exe or PuTTY in your windows start menu
  • Enter root@forward01.qarnot.net (or root@forward02.qarnot.net) in the Host Name field
  • Enter the {port number} in the Port field
  • (Optional) save your session information
  • Go to Connection>SSH>Auth and click “Allow agent forwarding”
  • Go to Connection>SSH>Auth>Credentials and “Browse” to your private_key.ppk file
  • Click Open to start the session and work on you Qarnot cluster
  • In the prompt, click “Accept” 
  • In the pop up terminal generated by putty, type in “root” and enter.

‍

Troubleshooting

‍Permission Issues:

Ensure the ~/.ssh directory and authorized_keys file on the remote server have the correct permissions:

1chmod 700 ~/.ssh
2chmod 600 ~/.ssh/authorized_keys

‍Passphrase Prompts:

If you're repeatedly prompted for a passphrase, consider using an SSH agent to cache your passphrase.

‍Connection Refused:

Verify that the SSH service is running on the remote server and that you're using the correct IP address and username.

Best Practices

Key Security

  • Keep your private key secure and never share it.
  • Use a strong passphrase to protect your private key.

‍Multiple Keys:

  • For different services or servers, consider using separate key pairs for enhanced security.

‍Regular Key Rotation:

  • Periodically generate new key pairs and update your authorized keys to minimize potential security risks.

Conclusion

By following this tutorial, you've successfully generated and configured SSH keys on both Windows and Linux systems. Utilizing SSH keys enhances security and simplifies the authentication process when connecting to your cloud HPC cluster. Remember to keep your private keys secure and adhere to best practices for optimal security.

For a visual guide on generating SSH keys using PuTTY on Windows, you might find the following video helpful:

y