Setting up SSH key based access to Apocrita

SSH keys allow secure, password-less access to remote systems such as Apocrita. They are very easy to set up and provide a greater level of security than using a password, while being convenient too.

Generating an SSH key-pair provides you with a public and a private key which are two files containing long character strings. You can place the public key on any server, and then unlock it by connecting to it from the computer that has the private key on it. If the two keys match up then you are given access to the remote system without the need for a password. Although it is possible to create a key-pair without a passphrase you should increase security even more by protecting the private key with a passphrase.

Never share your private key

Your private key is the part of the key pair that identifies you as yourself. Even if it is passphrase protected you should not share this file with anyone.

If you do not use the default location for keys please ensure that your key is saved somewhere that is protected under your user account on that machine.


Linux How To

Open a terminal:

# Generate Key
ssh-keygen

# Copy key to Apocrita
ssh-copy-id USERNAME@login2.hpc.qmul.ac.uk

# You can now login with your key
ssh USERNAME@login2.hpc.qmul.ac.uk

Mac OSX How To

Open Terminal (go to Applications -> Utilities -> Terminal):

# Generate Key
$ ssh-keygen

# Copy key to Apocrita
# Mac OS X does not provide ssh-copy-id
scp ~/.ssh/id_rsa.pub USERNAME@login2.hpc.qmul.ac.uk:~/.ssh/
ssh USERNAME@login2.hpc.qmul.ac.uk # password required

    chmod 600 ~/.ssh/id_rsa.pub
    cat id_rsa.pub >> authorized_keys
    chmod 600 authorized_keys
    logout

# You can now login with your key
$ ssh USERNAME@login2.hpc.qmul.ac.uk

Windows How To

MobaXterm

MobaXterm is the supported method of access from Windows.

Open MobaXterm:

# Generate Key
ssh-keygen

# Copy key to Apocrita
ssh-copy-id USERNAME@login2.hpc.qmul.ac.uk

# You can now login with your key
ssh USERNAME@login2.hpc.qmul.ac.uk