PASSWORD RESET

Your destination for complete Tech news

How to create ssh keys in Linux?

385 0
< 1 min read

To create SSH keys in Linux, you can use the ssh-keygen command. This command will generate a public and private key pair, which you can use to securely connect to remote servers over SSH.

To create an SSH key pair, open a terminal and type the following command:

ssh-keygen

The ssh-keygen command will prompt you to choose a location for the keys and a passphrase. You can press Enter to accept the default location, which is ~/.ssh/id_rsa, and to leave the passphrase empty.

Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

After you press Enter, the ssh-keygen command will generate your SSH key pair. You will see output similar to the following:

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:oRiEZB1T8zvFZ4jl3qh1QeW8V8Gv4GRV7XlZNBPz8hk username@hostname
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+----[SHA256]-----+

The private key is stored in the file ~/.ssh/id_rsa, and the public key is stored in the file ~/.ssh/id_rsa.pub. You can use the public key to authenticate with remote servers, and you should keep the private key secure.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.