step1 : Create public and private keys using ssh-key-gen on local-host
$ssh-keygen
step 2: Copy the public key to remote-host using ssh-copy-id
$ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
step 3: login remote host and change file permission
Change the permissions of .ssh to 700
$chmod 700 .ssh
Change the permissions of .ssh/authorized_keys to 640
$chmod 640 .ssh/authorized_keys