Password less ssh:
This is a quick HowTo for setting up password less ssh.
For example we have two servers server1 and server2 and
two users user1 in server1 and user2 in server2
Now from server 1 we want tgo password less ssh to server2
For this we need to follow a few steps
1. login to as user1 to server1
2. run "ssh-key-gen -t rsa" from command prompt
it will provide following out put
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
f6:61:a8:27:35:cf:4c:6d:13:22:70:cf:4c:c8:a0:23 user1@server1
Now you have private key at /home/user1/.ssh/id_rsa and
public key at /home/user1/.ssh/id_rsa.pub
3. Now we need to copy the content of /home/user1/.ssh/id_rsa.pub file to server2
4. login to server2 using user2 user
5. cd .ssh/
6. copy the entire content of /home/user1/.ssh/id_rsa.pub from server1 and put into authorized_keys
i.e /home/user2/.ssh/authorized_keys of server2
7. If you already have authorized_keys file with some other keys , then just append to it.
8. Now you can ssh as user1@server to user2@server2 without being promted for password.
No comments:
Post a Comment