Skip to content

Generating an SSH Key in Linux

  • You might already have one, check whether the file ~/.ssh/ is present.
  • Otherwise, create key using the following command (marking your key with your email address will make it easier to reidentify your key later on):
    host:~$ ssh-keygen -t rsa -C ""
  • Use the default location for your key
  • Enter the passphrase twice to encrypt your key

What is your key's passphrase?

You should set a passphrase when generating your private key. This passphrase is used for encrypting you private key to protect it against the private key file theft/being lost. When using the key for login, you will have to enter it (or the first time you load it into the SSH key agent). Note that when being asked for the passphrase this does not occur on the cluster (and is thus unrelated to it) but on your local computer.

Also see SSH Basics for more information.

The whole session should look something like this:

host:~$ ssh-keygen -t rsa -C ""
Generating public/private rsa key pair.
Enter file in which to save the key (/home/USER/.ssh/id_rsa): 
Created directory '/home/USER/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again: 
Your identification has been saved in /home/USER/.ssh/id_rsa.
Your public key has been saved in /home/USER/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
|         o  .. . |
|      . * o.  . .|
|       + O.o . ..|
|        =.o o . .|
|        S  + o   |
|          . +    |
|         .       |
|        . .o  E  |
|         oo ..   |

The file content of ~/.ssh/ should look something like this):

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Rdd5rvf4BT38jsBlRrXpd1KDvjE1iZZlEmkB6809QK7hV6RCG13VcyPTIHSQePycfcUv5q1Jdy28MpacL/nv1UR/o35xPBn2HkgB4OqnKtt86soCGMd9/YzQP5lY7V60kPBJbrXDApeqf+H1GALsFNQM6MCwicdE6zTqE1mzWVdhGymZR28hGJbV9H4snMDDc0tW4i3FHGrDdmb7wHM9THMx6OcCrnNyA9Sh2OyBH4MwItKfuqEg2rc56D7WAQ2JcmPQZTlBAYeFL/dYYKcXmbffEpXTbYh+7O0o9RAJ7T3uOUj/2IbSnsgg6fyw0Kotcg8iHAPvb61bZGPOEWZb

Submit Your Key

As a next step you need to submit the SSH key use these links as:

Last update: November 14, 2023