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
( 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:
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 assigned 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