Connecting to a server via SSH as root user is disabled by default. To enable this, edit the sshd configuration file:
nano /etc/ssh/sshd_configFind the following line:
#PermitRootLogin prohibit-passwordChange it to this.
PermitRootLogin yesNow restart the ssh service:
systemctl restart sshd