I want to be able to connect to root@localhost with a password and from the outside (root@my-ip) with a private key only. I didn't find what to write in /etc/ssh/sshd_config to allow this… If it requires both an SSH key and a password it's ok too.
Do you have an idea?
It depends on your openssh version, but in recent ones, you can set up:
PermitRootLogin prohibit-password
Match LocalAddress 127.0.0.1,::1 # localhost
PermitRootLogin yes
Or using some other equivalent that is supported by your version (PasswordAuthentication
).