Tuesday, December 8, 2009

Password less login/copy_files through ssh

Lets assume we have two machines named kutty(192.168.1.3) & nutty(192.168.1.6)
Now follow the below steps to login from kutty to nutty without password for user vivek
Step 1:
Execute the below commands in kutty
[vivek@kutty]# ssh-keygen -t rsa (This command will generate public/private keypair, by default ssh-keygen command picks RSA encryption & by -t option we can select DSA encryption as well. But, I prefer RSA.)

[vivek@kutty]# scp /home/vivek/.ssh/id_rsa.pub vivek@192.168.1.6:/tmp (This is to copy our kutty's public key to nutty)

Step 2:
In nutty execute the below commands

[vivek@nutty]# touch /home/vivek/.ssh/authorized_keys (Need to create only if authorized_keys file not exist )

[vivek@nutty]# cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys

Now we can login with out password through ssh from kutty to nutty

[vivek@kutty ~]# ssh vivek@192.168.1.6
Last login: Mon Nov 30 18:30:00 2009 from 192.168.1.3
[vivek@nutty ~]#

No comments:

Post a Comment