This is a solution for the problem where you know the root password but cannot ssh as root.

Actually, there is a parameter in the sshd configuration file that controls whether root login is allowed. On Linux, edit the configuration file /etc/ssh/sshd_config:

1
PermitRootLogin no

Change it to:

1
PermitRootLogin yes

Then restart sshd, and you will be able to access as root.

1
systemctl restart sshd

There is also a parameter to disable automatic login as shown below:

1
PubkeyAuthentication no

You can also set individual settings for specific IP addresses:

1
2
Match Address 172.25.0.11
    PubkeyAuthentication no