How to use SSH Keys on SCIAMA

You are here:
Estimated reading time: 2 min

Creating SSH key pairs

To top

Please check out the related KB article HERE on how to create a new SSH key pair on various operating systems.

Copying/Installing keys onto SCIAMA (with access)

To top
These instructions are for users with working access to SCIAMA (e.g. via training account with password or via another private/public key pair). All other SCIAMA users have to send their new public ssh key attached as a file (not copy&pasted) by email to the SCIAMA support. Non-local users may be asked to provide further proof of their identity.

Now that you have created a private and public key you need to copy the public key onto Sciama using your existing access. Use the command :-

scp <path to your pub key> <username>@login4.sciama.icg.port.ac.uk:~/new_key.pub
ssh <username>@login4.sciama.icg.port.ac.uk 'cat ~/new_key.pub >> .ssh/authorized_keys'

You should see output similar to if you log into this login node for the first time:-

The authenticity of host ‘login4.sciama.icg.port.ac.uk (148.197.10.71)’ can’t be established.
RSA key fingerprint is SHA256:zELprgvBZmyQRQ5/6/a58e3e660bR3lJZItu18pnZcg.
Are you sure you want to continue connecting (yes/no)? yes

Now try logging into the machine, with:

ssh <username>@login4.sciama.icg.port.ac.uk

You will be prompted for your pass phrase:-
Enter passphrase for key ‘$HOME/.ssh/id_rsa’:
Last login: Sat Apr 28 17:28:18 2018 from host.somewhere

and check to make sure that only the key(s) you wanted were added to your authorized_keys file in your $HOME/.ssh folder on the TARGET machine i.e. in this case the login server:

cat $HOME/.ssh/authorized_keys

In the output, you should find all the public keys of the rsa keys you added (plus in case of SCIAMA one Alces public key needed for maintenance). You can compare them with the content of the $HOME/.ssh/id_rsa.pub file on the machines you log in from.

Now try logging in using your new key … you should now be asked for your passphrase and then successfully being logged in.

Using SSH key agents

To top

If you don’t want to enter the passphrase each time you can start an ssh agent that will do it for you. As an example, on your Linux desktop :-

eval ‘ssh-agent bash’
ssh-add
Enter passphrase for $HOME/.ssh/id_rsa:

Every time the agent is restarted (e.g. after a reboot) the keys will need to be re-added.

Other operating systems also provide similar key management software (e.g. PuTTY’s pageant tool).

Was this article helpful?
Dislike 0
Views: 36