page-banner-shape-1
page-banner-shape-2

How To Create and Install SSH Keys on the Shell

  • Deepak Udai
  • September 11, 2020
SSH and shell

How To Create and Install SSH Keys on the Shell

SSH Key Authentication

1.1 SSH Keys-An Overview

SSH keys are a way to identify trusted computers without involving passwords. You can generate an SSH key and add the public key to your GitHub account by following the procedures outlined in this section.

1.2 How to generate ssh key on Linux

Run all these command on your local system

# ssh-keygen

( Users need to press ENTER in order to save the file to the user home )

Upon entering the primary Gen Key command, users need to go through the following drill by answering the following prompts:

Enter the file where you wish to save the key (/home/demo/.ssh/id_rsa) : enter

Enter passphrase: enter

The output should be like this :

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
38:16:50:fe:8d:da:02:bb:46:1b:66:0c:10:8e:81:2d [email protected]
The key’s randomart image is:
+–[ RSA 2048]—-+
|+o … |
|E.. o |
|.+ o |
| . + o |
| o. + S . |
| *+ + |
| +.oo . |
| o. . |
| .. |
+—————–+

Now we have generated two files ( id_rsa and id_rsa.pub ) and we need to check permission for both files. The permission should be 644 for both. if permission didn’t assign accordingly then we have to assign.

# chmod 644 id_rsa
# chmod 644 id_rsa.pub

Now we need to locate key file on the Linux VPS server which one we want to access without password.

# ssh-copy-id  username@server IP address

Now try to login using key file.

# ssh -i id_rsa username@serverIPaddress

Deepak Udai

He is a cloud infrastructure and reliability engineering leader with a strong focus on performance, automation, and scalability. Known for solving complex technical challenges, he supports teams through mentorship and collaboration while delivering efficient, high-performance solutions from planning to deployment.

Call Now Button