SSH setup (Linux/Mac)

Secure Shell (SSH) is a way to login to remote computers securely as all data is encrypted in both directions between the local computer (your laptop) and the remote computer (Abacus 2.0).

Using SSH keys is an even more secure way to use SSH to access a remote compute as there is no password exchange between the local and remote computer. An SSH key pair is generated on the local computer. The key pair consists of a private key which stays on your local computer and a public key which must be uploaded to the remote computer.

SSH using SSH keys is the only way to get remote access to Abacus 2.0. The steps below walk you through how to generate your own SSH key for access to the cluster.

This is our guide for Linux and Mac users. Windows users should instead look at our guide specific for Windows users.

Software

Linux and mac users have an OpenSSH client installed by default on their system and do not need to do anything specific.

For file transfers to Abacus, we suggest using the built-in scp program. Mac users who prefer a GUI can use, e.g., Cyberduck.

Check for existing SSH keys

First, we check for existing keys on your computer. Open a command line and enter:

peter@laptop:~$ ls -al ~/.ssh/
You should see a list of files in your .ssh directory if it exists

Check to see whether you already have a public SSH key. By default, filenames of public keys are one of the following:

  • id_dsa.pub
  • id_ecdsa.pub
  • id_ed25519.pub
  • id_rsa.pub

If you have a file ending with .pub and also have the file without .pub, e.g., id_rsa.pub and id_rsa, and you can remember the passphrase for you ssh key pair, you can skip the next step.

Generate a new SSH key

Run the following command to generate a new SSH key. Replace Office PC with a descriptive text of computer you are generating the key on. You should use the default password, and a strong passphrase to safeguard the key.

peter@laptop:~$ ssh-keygen -t rsa -C "Office PC"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/peter/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/peter/.ssh/id_rsa.
Your public key has been saved in /home/peter/.ssh/id_rsa.pub.
The key fingerprint is:
84:9b:de:ae:30:db:31:37:e6:41:17:c0:45:59:e8:bb Office PC
The key's randomart image is:
+--[ RSA 2048]----+
|       ..oo+.    |
|       ...o      |
|      . ...      |
|       +  ..     |
|      o S ..     |
|     . o ..      |
|    o + *  .     |
|     = B oE      |
|    . o.o        |
+-----------------+

Add the public SSH key to your Abacus account

Sign in to our admin home page

https://deic-adm.sdu.dk/admin/.

Go to your User's page and select Add SSH Key. Now go to the command line and get the contents of your public key by running this command, and copy + pasting the result. It is very important to copy public key exactly as it appears in the terminal window.

peter@laptop:~$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkHCVVojMcOe6eqy54AET0fTD2mkwLBUYAf6G
zTZuajq7ywkW7aKYCnVua8kcdWEVpy4GHXhGVoJv2aeP6YxhpJAZpj155Oe/+JEmpVcJclKwTwX
iJmKZZnfYtgkA8+zQGMhFCdZLajhhO9tX9KcgM+sREXfgUO4d3qdNBsNM6xlPKWmPRx+eaMgKaf
Ligu1AWjqNI+kMT1tPeIhJbv6/P5mTFCtXw6RVSn03TBCM1AYIf0kqXi1+1UPiQKgx8aZAVyPOx
iziyxih/ecHFJhk8XTBaMAYYEg2aaiHHANhFY2X3bOjcQ/RdRsZ1TXbBA8of9u4F25y460HL4Ba
JjXWL Office PC

Note that you should expect up to 15 minutes delay for the new key to be effective on the cluster, i.e., wait a few minutes before trying whether everything works as expected.

Connecting to Abacus 2.0

After uploading the key and waiting some minutes (up to 15 minutes), you are now ready to login using your new ssh key. Go to a terminal window, and use the ssh command as shown below, of course replacing testuser with the user name you selected on our admin home page.

peter@laptop:~$ ssh testuser@fe.deic.sdu.dk
    _    _                            ____    ___
   / \  | |__   __ _  ___ _   _ ___  |___ \  / _ \
  / _ \ | '_ \ / _` |/ __| | | / __|   __) || | | |
 / ___ \| |_) | (_| | (__| |_| \__ \  / __/ | |_| |
/_/   \_\_.__/ \__,_|\___|\__,_|___/ |_____(_)___/

Welcome to DeIC National HPC Centre, SDU
...
testuser@fe1:~$

Data transfer

To copy files to and from Abacus you can use direct scp or sftp to the frontend nodes, fe.deic.sdu.dk. Note that you in all cases must use the SSH key you uploaded earlier.

SSH Tips

SSH configuration

You can use the file ~/.ssh/config to setup parameters for SSH that you otherwise must enter at each login. This is done on the client (your laptop). Basically you create a section per remote computer. The special Host * section will match any computer, i.e., using the following, we always ask ssh to forward X11 sessions from the remote computer.

#
# Contents of ~/.ssh/config on your laptop
#
Host abacus
    Hostname fe.deic.sdu.dk
    User testuser

#
# Setup for another HPC facility you have access to
#
Host france
    Hostname other.computer.in.france.fr
    User pierre

# Entries in "Host *" are used as default values
# - unless something else is specified above
Host *
    ForwardX11 yes

With the above file in place, you can now simply use

peter@laptop:~$ ssh abacus

instead of

peter@laptop:~$ ssh -X testuser@fe.deic.sdu.dk