SSH key-based authentication

Users can authenticate ssh logins without a password by using public key authentication. ssh allows users to authenticate using a private-public key scheme. This means that two keys are generated i.e a private key and a public key. The private key file is used as the authentication credential, and like a password, must be kept secret and secure. The public key is copied to systems the user wants to log into, and is used to verify the private key. The public key does not need to be secret.

An SSH server that has the public key can issue a challenge that can only be answered by a system holding your private key. As a result, you can authenticate using the presence of you key. This allow you to access systems in a way that doesn’t require typing a password every time, but is still secure.

In this example,
Remote host:  (Machine that we are going to connect pass-wordlessly)

  1. Create your key with necessary details:


    When there is a request of password just leave it blank. The blank password will do the work

  2. Copy the public key to remote host:

    [nepalisupport@blog~]$ssh-copy-id -i ~/.ssh/

    In this process you will be asked to put password of remote machine.

  3. Check the connection:


This tutorial is created based on other technical blog and is fully tested on Centos 6.6. Feel free to comment.

Thank you.

For more reading materials please click here