Generate SSH keys

To generate SSH keys, ensure that you have ssh-keygen command-line tool installed. ssh-keygen is a utility for generating SSH key pairs and storing them in a secure location. With these keys, you can connect to your instances without encountering the login prompt. You can use the SSH keys on a macOS or a Linux using an SSH client.

You can manually generate SSH keys when working with a SSH client using the following:

  1. Enter the following command into the terminal window on your computer and press ENTER.

ssh-keygen

Result: The key generation process is initiated by the command above. When you run this command, the ssh-keygen utility prompts you for a location to save the key.

  1. Accept the default location by pressing the ENTER key, or enter the path to the file where you want to save the key /home/username/.ssh/id_rsa.

Enter file in which to save the key (/home/username/.ssh/id_rsa):

If you have previously generated a key pair, you may see the following prompt. If you choose to overwrite the key, you will no longer authenticate with the previous key.

/home/username/.ssh/id_rsa already exists.
Overwrite (y/n)?
  1. Enter the passphrase that will be used to encrypt the private key file on the disk. You can also press ENTER to accept the default (no passphrase) SSH key. However, we recommend that you use a passphrase.

  2. Enter your passphrase once more.

Result: After you confirm the passphrase, the public and private keys are generated and saved in the specified location. — The public key is saved in the id_rsa.pub file. Remember to upload this key to your DCD account. — Your private key is saved in the id_rsa file in the .ssh directory and is used to verify if the public key you use belongs to the same DCD account. You will receive a similar confirmation message:

Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:AcP/ieiAOoD7MjrKepXks/qHAhrRasGOysiaIR94Quk username@mb01739.local
The key's randomart image is:
+---[RSA 3072]----+
|     .o          |
|      .o         |
|..     ..        |
|.oo .   ..       |
|+=.+ . .So .     |
|X+. * . . o      |
|&Eo. *           |
|&Oo.o o          |
|@O++..           |
+----[SHA256]-----+

You can copy the public key to your clipboard by running the following command:

 pbcopy < ~/.ssh/id_rsa.pub

Last updated