§ 013 · Linux

How to Create SSH Keys

An SSH key consists of a pair of files: the private key and the public key. The private key is confidential and should never be shared, while the public key enables you to log into the servers, containers, and VMs you set up. When creating these keys using the ssh-keygen command, the keys are stored securely, allowing you to bypass the login prompt when connecting to your instances.

To generate SSH keys, follow these steps:

  1. Enter the following command in the shell.

    The -t option specifies the type of key to generate. Here, rsa is chosen due to its widespread use, though other types such as dsa, ecdsa, ed25519, or rsa for different security needs can be selected, depending on your requirements. From the man documentation:

    This command initiates the key generation process. ssh-keygen will then prompt you to specify a storage location for the key.
  2. Enter a passphrase for added security or press ENTER to proceed without one (not recommended for security reasons).
  3. Confirm the passphrase by entering it again. Upon confirming the passphrase, the system generates the key pair and provides a summary of the operation, including the location of the saved key pair and a key fingerprint for verification purposes.

The generated output will resemble the following:

Your private key (id_rsa) is stored in the .ssh directory and is critical for verifying your public key’s association with your user account.

Never share your private key with anyone! 

Written by

Vinicius Grippa

Writes this blog. Mostly about databases. Boring on purpose.

More about me →

The floor is yours.

0 comments · Moderated · civil & on-topic

First comment appears here once approved. Questions, corrections, and counterpoints welcome — just no self-promotion.

Add a comment

Your email address is never published. * required

Subscribe · Posted when ready

A quiet, technical email about databases.

One post per send, corrections when I’m wrong, nothing else. No social-media cross-posts. No “what we learned.”

Unsubscribe with any reply