You make it work as root by leaving the configuration alone.
MacUser2525:~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3N
MacUser2525:~$ ssh [email protected]
Linux buster-raspi 5.9.0-0.bpo.5-arm64 #1 SMP Debian 5.9.15-1~bpo10+1 (2020-12-31) aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Feb 23 22:22:43 2021 from fe80::1003:5492:80fa:2bc5%eth0
root@buster-raspi:~# cat .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1
With this setting you enabled you have allowed root to login with a password.
root@buster-raspi:~# cat /etc/ssh/sshd_config | grep Root
#PermitRootLogin prohibit-password
# the setting of "PermitRootLogin without-password".
These are not needed to be changed as well.
root@buster-raspi:~# cat /etc/ssh/sshd_config | grep Pubkey
#PubkeyAuthentication yes
root@buster-raspi:~# cat /etc/ssh/sshd_config | grep Authorized
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
In short I have nothing set that you do only the defaults that load, the contents of my id_rsa.pub
in the /root/.ssh/authorized_keys
file allows me to login as root. At least the guide you follow has not told you to change the port. This will only work if the root user is enabled on your Pi I see nothing saying you did this.
sudo passwd root
That sets your root password and enables the root user.
I would add this is only used by me for one purpose. Backing up the Pi to my backup drive over the network it needs root access for those files owned by it, as the Pi USB implementation is so poor, it is faster to do it that way. All you save by not doing it the correct more secure way of logging in as normal user then going to root with su is one step.
~root/.ssh
owned by root anddrwx --- ---
(700)? Isauthorized_keys
owned by root and-rw- --- ---
(600)?/home/pi/
and not/root/
. As far as I remember I got an error otherwise and could not proceed any further