SSH login using public key failed

listed in answer

SSH login using public key failed
0 votes, 0.00 avg. rating (0% score)

ANSWER:

  1. Whenever encountering a problem ssh’ing to a server, it’s always best to add the ‘-v’ flag eg

ssh -v host -l user

  1. In both above cases, the public key (id_rsa.pub) should be added to the “remote user’s .ssh/authorized_keys” file. In your case above, both to root and user1. This can easily be done via the ssh-copy-id command.

  2. /var/log/secure will hold clues as to why the login was not successful.

  3. Directory permissions should be 700 [rwx] (not 600) [rw-]

by rprimus from http://serverfault.com/questions/381977