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:
- Launch MobaXterm from the applications list (opens from the windows logo) or search for it in the bottom bar search box.
- Open a terminal with it (i.e. you’ll stay on your local machine)
- 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.
- Continue the previous guide at Docs CSC
- You will likely be asked to restart MobaXterm, do so.
- Select puhti.csc.fi from your left connections menu and try launching e.g. Jupyter Notebook interactively and access it via your browser
Linux
- Open a terminal on your local machine
- Create the SSH-key in the terminal by typing:
ssh-keygen -o -a 100 -t ed25519
- Accept the default name and location (or customize them if needed).
- Choose a secure passphrase for the SSH key.
- It should be at least 8 characters long and should contain numbers, letters and special characters.
- Copy the public key to Puhti (replace
cscusername
with your CSC username):
ssh-copy-id cscusername@puhti.csc.fi
- Connecting with SSH to Puhti should now proceed without the need to write your key passphrase
macOS
- Open a terminal on your local machine
- Create the SSH key in the terminal by typing:
ssh-keygen -o -a 100 -t ed25519
- Accept the default name and location (or customize them if needed).
- Choose a secure passphrase for the SSH key.
- It should be at least 8 characters long and should contain numbers, letters and special characters.
- Open
~/.ssh/config
and add the following lines into the file:
Host *
UseKeychain no
AddKeysToAgent yes
- Open
~/.bash_profile
(or equivalent, see below ⬇️) and add the following line:
[[ -z ${SSH_AUTH_SOCK+x} ]] && eval "$(ssh-agent -s)"
- 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.