Let's open the SSH configuration again:
__$ sudo nano /etc/ssh/sshd_config
PermitRootLogin
we comment in and set the value to no
. This prevents the root
user from logging in externally.
Excerpt from /etc/ssh/sshd_config
...
PermitRootLogin no
...
After saving, we restart the SSH service again:
__$ sudo systemctl restart sshd
To make sure that everything is configured correctly, you can try to log in as root
without a key file.