Saturday, February 15, 2014

ssh login without password

1)  Install ssh on both Host , we will take as client1 and client2 . Here client1 will login to client2 through ssh without password.

2)from client1:
cd ~
ssh-keygen -t rsa

Enter file in which to save the key (/home/client1/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/kshyama/.ssh/id_rsa.
Your public key has been saved in /home/kshyama/.ssh/id_rsa.pub.
The key fingerprint is:
da:0d:08:10:8c:e6:59:2d:b0:59:8d:cf:3f:bd:70:e6 kshyama@kshyama
The key's randomart image is:
+--[ RSA 2048]----+
| ooo..+          |
|....++ o         |
|o  oo +          |
| . . . +         |
|  .   . S .      |
|       o * +     |
|      . . B .    |
|           E     |
|                 |
+-----------------+


3)cat .ssh/id_rsa.pub | ssh client2@192.168.3.20 'cat >> .ssh/authorized_keys'

Now you are done. The ssh connection will not ask any password from client1 to client2

No comments:

Post a Comment