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 root@server1.example.com
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