Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I am corious how you could set this up to work. The option AuthorizedKeysFile points to .ssh/authorized_keys. If I remove it - it works for me too. So I assume the default values are used, if not changed in the config. But if I change the option PubkeyAuthentication yes to #PubkeyAuthentication yes, it still works. So actually only PermitRootLogin yes needs to be changed I assume. I appreciate you pointing that out. So you could actually boil down the steps to only enable PermitRootLogin yes, generate a keypair & place the public key in authorized_keys of the user directory.
You resolved my problem. Thank you very much. If I place the public key in /root/.ssh/authorized_keys I can login as root. I was so close yesterday tho...
@LjmDullaart Yes, I forgot to include that. I set those permissions. Even tho the files are located in /home/pi/ and not /root/. As far as I remember I got an error otherwise and could not proceed any further