Password less SSH

In this post I would explain how to make the 2 servers( Remote and Local) password less .

Lets take a scenario

Resources : ServerA , ServerB
Requirements : To make ServerB password less (i.e., while you enter ‘sshusername@ServerB’ it should not prompt you for a password )
Explanation :To do this Generate a key pair on ServerA ( There are 2 types of keys rsa and dsa , you can use anyone of those)
ServerA@db2:~/.ssh> ssh-keygen -t rsa

Here is what you get

Generating public/private rsa key pair.
Enter file in which to save the key (/home-dir/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):Your Password here
Enter same passphrase again:Your Password here
Your identification has been saved in /home-dir/.ssh/id_rsa.
Your public key has been saved in /home-dir/.ssh/
The key fingerprint is:

So there we got 2 keys generated one public key (.pub) and other private . This public key is what we need to copy to ServerB to make a link between these 2 servers

Now the question is where to copy in ServerB
Well it should always be copied to .ssh directory of the Target Server of the username
Here is how you do that

scp user@ServerB:/home-dir/.ssh/authorized_keys
The authenticity of host ‘ServerB (ServerB)’ can’t be established.
RSA key fingerprint is 7b:02:49:c9:17:3d:02:72:74:44:40:5a:00:64:b3:c6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘ServerB’ (RSA) to the list of known hosts.
user@ServerB’s password:


  1. this worked perfectly and it helped me save a lot time from typing passwords all time

  2. Adding to your document a more detailed explanation:

  3. I follow that site , its very informative