This is something that I always forget how to do. Here is the recipe adapted from Linux Server Hacks.
- First generate your key
$ ssh-keygen -t rsa
This created two files,
5. Then copy the key pair to the host you want to login to
$ ssh -l userserver “mkdir .ssh; chmod 0700 .ssh”*
$ scp .ssh/id_rsa.pub *user@server:.ssh/authorized_keys2
6. Now you can login using
$ ssh -l eechrisserver**
and you don’t need a password. Exchange of public keys authenticates you.