Step 1:Create public and private keys using ssh-key-gen on local machine
user@localhost$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
Step 2: Copy the public key to remote host using ssh-copy-id on localhost
user@localhost$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote_user@remote_host
Step 3: Login to remote host without entering the password
ssh remote_user@remote_host