First generate a public key as follows
myhost@myhost-lap:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/myhost/.ssh/id_rsa): Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/myhost/.ssh/id_rsa.
Your public key has been saved in /home/myhost/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
| o |
| o o |
| . .....o. |
| o..... ...|
| . o. . ..+.|
| .. ooooo|
myhost@myhost-lap:~$ ssh user@targethost mkdir -p .ssh
Then add the entries into the target host's autherized keys
myhost@myhost-lap:~$ cat .ssh/id_rsa.pub | ssh user@targethost 'cat >> .ssh/authorized_keys'
Finally you could login like following without a password
myhost@myhost-lap:~$ ssh user@targethost