Creating an SSH key pair

You are here:
Estimated reading time: 1 min

This article describes how to generate an SSH key on your own machine that can then be used to authenticate your connection to a target machine like the SCIAMA login nodes.

While SSH key generation does not require you to set a passphrase, for important security reason SCIAMA does require its users to only use keys protected with a reasonably strong passphrase. Users who are not obeying this may be held responsible for any damage caused as a result.

Windows

To top

If you are using a Windows desktop, you can use tools like puttygen, which is part of the PuTTY software package:


Try not to use less than 4096 bits to ensure that your key is strong enough.

Make sure that when you save the public key, that it is a text file which contains exactly what is shown in the window above (i.e. remove any prefixes/suffixes like ‘---- BEGIN SSH2 PUBLIC KEY ---- Comment:‘ or ‘---- END SSH2 PUBLIC KEY ----‘.

Linux / macOS

To top

If you are using a Linux or macOS desktop then use the command

ssh-keygen -t rsa -b 4096

Try not to use less than 4096 bits to ensure that your key is strong enough.

When prompted make sure you use a secure pass phrase. You should see output similar to:-

Generating public/private rsa key pair.
Enter file in which to save the key ($HOME/.ssh/id_rsa):
Created directory ‘$HOME/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in $HOME/.ssh/id_rsa.
Your public key has been saved in $HOME/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:2MTKd1MxNd40BLd8yY5HQrZJ/YgVBVMkL48b/Wp1A/w juser@server
The key’s randomart image is:
+—[RSA 2048]—-+
| o*@X=|
| . ++BO+|
| o o*oB=|
| . = ..o*=o|
| + S o .=oo|
| . . . .E+|
| ..+|
| .. |
| .. |
+—-[SHA256]—–+

You can find the private/public key pair at the location you defined at its creation. You can identify the public key by its suffix ‘.pub’.

Was this article helpful?
Dislike 0
Views: 5460