• 1-888-289-2246
  • 24x7x365 Presence

Password-less SSH authentication to a remote machine


If you’re getting irritated or tired of giving your password again and again during SSH login to a remote host, then there is another way using which you can do SSH access to the remote host: RSA/DSA key-based authentication.

For this you’ll need to create the RSA/DSA-based public/private key on the source host and save that key on the remote host so that whenever you do SSH access from the source host, the target host will authenticate you on the basis of the key you stored.

Below is the way using which you can create and store the key on the remote host and then do password-less SSH access to the remote host.

Step 1: Create the SSH key on the source host using the command below:-

ssh-keygen -t rsa
Generating public/private RSA key pair.
Enter the file in which to save the key (/root/.ssh/id_rsa): [press enter]

Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):  

-> Above that, it’ll prompt you for entering the passphrase. So either enter your passphrase or just press enter.

Enter the same passphrase again:
-> You will be prompted again to enter the passphrase.

Step 2: Use the command below to save the private key on the remote host:-

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

It’ll prompt you for the password of the remote host in order to save the key on the remote host – and that’s it.

Step 3: Now, try to do SSH access on the remote host using the command below:-

ssh remote-host

Ex- ssh [email protected]

and you’ll be directly entered into the remote host without being prompted for the password.

So, this way you can login onto the remote host without a password.

]]>


Leave a Reply

Your email address will not be published. Required fields are marked *