Setup public key authorized SSH for non-root users

Solution 1:

Remove the authorized_keys entry in your config file. Restart sshd. Make a .ssh directory in your non-root user home directory. Put the key in a file called ~/.ssh/authorized keys. Make the directory 0700 and the authorized_keys file 0644. Do the same for the root user.

Solution 2:

Just to be clear, you need the PUBLIC key file (e.g. ~/.ssh/id_rsa.pub) from the origin machine to be in ~/.ssh/authorized_keys on the destination machine.

If you copy over ~/.ssh/id_rsa then that won't work. Modern sshd will also insist on ~/.ssh being mode 700 and ~/.ssh/authorized_keys being mode 600 on the destination machine.

Aside: if you can, use sudo instead of allowing root logins over ssh.