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
  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):
/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.

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

Was this helpful?