Skip to content
Learning Outcomes
  • Understand how to create or enter existing SSH key pairs.
  • Identify the steps to use your own SSH keys or generate new ones.
  • Learn how to securely store and use SSH keys for establishing connections.

SSH Keys

In most cases, your SSH key is automatically configured for you. However, if you're submitting jobs to an HPC/cluster environment, you may need to define SSH keys in Foundry.

Determine your setup

Case 1: Your SSH key is already configured (most users)

To confirm your SSH credentials are already set up:

  1. Go to Profile.
  2. Open the Credentials tab.
  3. Look for an existing SSH credential.

If you see an SSH credential, you’re done. If you don’t, continue to Case 2.

Case 2: You’re submitting jobs to an HPC/cluster environment

If you submit jobs to an HPC/cluster environment, you need to define SSH keys in Foundry so Foundry can authenticate to the cluster.

Create SSH keys in Foundry

SSH Keys Sidebar Image

To create an SSH key pair:

  1. Click "Create Credential".
  2. In the Credential Type section select "SSH".
  3. To generate a new pair of SSH keys, assign a name in the Credential Name section and click Generate Keys for Me, then click Save.

Once you have saved your SSH key, your information will be encrypted and securely stored.

Authorize the key on your cluster

To establish a secure connection, you need to add your public key to the ~/.ssh/authorized_keys file on the host machine (your cluster). This step ensures that your public key is recognized and authorized for secure communication with the host.

  1. Connect to your HPC/cluster login node:

    ssh your-username@your-cluster-hostname
    

    Using Terminal (macOS/Linux):

    • Open Terminal (macOS: Spotlight → “Terminal”; Linux: Applications → “Terminal”).
    • Replace:
      • your-username with your HPC account username
      • your-cluster-hostname with the cluster login address (for example, login.myhpc.edu)
    • If prompted the first time you connect, type yes and press Enter.

    Using Windows Terminal / PowerShell (Windows):

    • Open Windows Terminal or PowerShell.
    • Run the same ssh your-username@your-cluster-hostname command.
    • If prompted the first time you connect, type yes and press Enter.
    • If your organization uses PuTTY, you can connect using PuTTY instead with the hostname and your username.
  2. On the cluster, create ~/.ssh/authorized_keys file (if needed) and set secure permissions:

    mkdir -p ~/.ssh && chmod 700 ~/.ssh 
    touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
    
  3. Switch back to Foundry to copy your public key:

    • Open your SSH credential.
    • Click the three-dot () menu next to the key and select View.
    • Click Copy.

SSH Keys Sidebar Image

  1. Append your public key to ~/.ssh/authorized_keys by running the command below, replacing PASTE_PUBLIC_KEY_HERE with the public key you copied from Foundry:

    echo "PASTE_PUBLIC_KEY_HERE" >> ~/.ssh/authorized_keys
    
    • >> means append (it will not overwrite the file).
    • The public key should be one line and typically starts with ssh-ed25519 or ssh-rsa. (e.g. sh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... user@foundry)
  2. (Optional) Verify it was added. The command below should print the public key you just added.

    cat ~/.ssh/authorized_keys
    
Use Your Own Keys (optional)

If you choose Use Your Own Keys (instead of Generate Keys for Me), you must paste both your private key and public key into Foundry. These files are typically located at:

  • ~/.ssh/id_rsa for the private key
  • ~/.ssh/id_rsa.pub for the public key
Need Assistance?

If you require help with adding your public key or have any questions, please don't hesitate to contact us at support@viascientific.com.