Friday 6 July 2012

How To Generate SSH Keys for automatic login to target host


To Generate Key

On source host run ssh-keygen(1)
ssh-keygen -t rsa -b 2048Take defaults on prompts.
This will generate two files in .ssh
.ssh/id_rsa.pub
.ssh/id_rsa
Copy these from source to target host with
cat .ssh/id_rsa.pub | ssh user@target "cat >> .ssh/authorized_keys; chmod 600 \ .ssh/authorized_keys"
Now you can login without password from source to target using
ssh target

References

http://www.openssh.org/manual.html
http://www.wikihow.com/Use-SSH
http://en.wikipedia.org/wiki/RSA_(algorithm)