TL;DR
On Client side:
- open configuration file
/etc/ssh/ssh_config;
- here look for
PreferredAuthentications;
- make sure
password comes after publickey and not viceversa
In my case password was written before publickey, so ssh would prompt me for password even though I had copied my pub_key onto server.
This problem can be found out easily using verbose:
ssh -v compute@compute1
...
...
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
As you can see password is chosen before trying to use publickey.
Edit /etc/ssh/ssh_config by moving password after publickey
PreferredAuthentications keyboard-interactive,publickey,password,hostbased,gssapi-with-mi
Now I can login without being prompt for pwd.