Passwordless login via SSH is especially useful in automated backup scripts.
In this tutorial Host A refers to the computer from which (source) you want to login, and Host B refers to the computer to which (destination) you want to login without a password.
Step 1 – Generate a key pair on Host A
Press ENTER for the three questions you are prompted with
Step 2 – Copy Host A's public key to Host B
The following command must be run on Host A:
ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostb
You will then be prompted with the password for username@hostb – enter this once and never again 🙂 This command copies the public key generated in Step 1 to the authorized_keys file on Host B thus allowing login without a password.