Login to Members Area

Choose the service you want to log in
24x7x365 Presence
Live Chat

Hosting Blog


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.

Sachin Wednesday 05 February 2014 - 05:17 am | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.