Creating and adding SSH keys

💬 SSH keys improve security and ease of use.

☝🏻 This tutorial assumes you’ve already logged in and have the prerequisites covered.

Windows 10

💬 On Windows 10, there are multiple ssh clients available, such as PuTTY and MobaXterm.

‼️ In this tutorial, we assume you use MobaXterm. More examples can be found in Docs CSC.

Create SSH keys

💬 The MobaXterm terminal has many Linux command line tools available, e.g. the ones to set up ssh keys:

  1. Launch MobaXterm from the applications list (opens from the windows logo) or search for it in the bottom bar search box.
  2. Open a terminal with it (i.e. you’ll stay on your local machine)
  3. Follow these step-by-step instructions

Set up MobaXterm to use the keys for Puhti

☝🏻 Some additional steps are needed to enable connecting to Puhti and using e.g. Jupyter Notebooks and R-servers from interactive batch jobs via your browser.

💬 The next steps show how to edit your local ssh config file and how to use an ssh-agent to use your key securely to access Puhti.

  1. Continue the previous guide at Docs CSC
  2. You will likely be asked to restart MobaXterm, do so.
  3. Select puhti.csc.fi from your left connections menu and try launching e.g. Jupyter Notebook interactively and access it via your browser

Linux

  1. Open a terminal on your local machine
  2. Create the SSH-key in the terminal by typing:
ssh-keygen -o -a 100 -t ed25519
  1. Accept the default name and location (or customize them if needed).
  2. Choose a secure passphrase for the SSH key.
    • It should be at least 8 characters long and should contain numbers, letters and special characters.
  3. Copy the public key to Puhti (replace cscusername with your CSC username):
ssh-copy-id cscusername@puhti.csc.fi
  1. Connecting with SSH to Puhti should now proceed without the need to write your key passphrase

macOS

  1. Open a terminal on your local machine
  2. Create the SSH key in the terminal by typing:
ssh-keygen -o -a 100 -t ed25519
  1. Accept the default name and location (or customize them if needed).
  2. Choose a secure passphrase for the SSH key.
    • It should be at least 8 characters long and should contain numbers, letters and special characters.
  3. Open ~/.ssh/config and add the following lines into the file:
Host *
    UseKeychain no
    AddKeysToAgent yes
  1. Open ~/.bash_profile (or equivalent, see below ⬇️) and add the following line:
[[ -z ${SSH_AUTH_SOCK+x} ]] && eval "$(ssh-agent -s)"
  1. Copy the SSH public key to Puhti by typing in the terminal (replace cscusername with your CSC username):
ssh-copy-id cscusername@puhti.csc.fi

☝🏻 Equivalent files for configuring profile in step 6.

  • ~/.bashrc
  • ~/.bash_rc
  • ~/.bash_profile

And with zsh-shell

  • ~/.zshrc
  • ~/.zsh_rc
  • ~/.zsh_profile

More information

💭 More in-depth step-by-step instructions in Docs CSC.

‼️ If you make changes to your environment (e.g. edit .bashrc) in CSC supercomputers, it is possible that there will be conflicts with applications installed by CSC.

💭 If you have problems after making changes to your environment, it is possible to restore it to default state permanently or temporarily using the csc-env command.