Add SSH key to root user

On your device, create a new SSH key (private/public key).

Get the content of the public key.

On the remote host (with sudo -i)

mkdir -p /root/.ssh

Then open the file

nano /root/.ssh/authorized_keys

And paste the content of the public key at the end of the file. Exit and save.

Open ssh configuration

nano /etc/ssh/sshd_config

Be sure that the line PermitRootLogin is uncommented and with the value

PermitRootLogin prohibit-password # Access with Key

Restart SSH daemon.