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
💬 On Windows, 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.
💬 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.
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.