NOTE:
This is the way not only for ssh but also for scp and sftp as well…

TROUBLESHOOTING:
If the password prompt will be shown again check the /etc/ssh/ssh_config and uncomment or insert the following option:

IdentityFile ~/.ssh/id_rsa

As you can see, the above option is for RSA type keys. If you want to generate the key pairs using DSA change the “id_rsa” with “id_dsa”. Sound logic, right?
This modification in /etc/ssh/ssh_config file can be avoided if you will use the parameter “-i” followed by the location of the key file as in example:

[user1@computer1]$ ssh -i $HOME/.ssh/id_rsa user2@computer2

Also, if you do have write permissions for either the .ssh directory or for the authorized_keys file on the remote machine, then sshd will consider that the procedure is not safe enough, so it will abort the RSA challenge-authentication mode (mode 3) and will go to the default mode (mode 5) asking you for the password on the remote machine. Set chmod 700 for .ssh folder and 600 authorized_keys file.