In some OSes, by default it is forbidden for the root user to log in using a password; to change this, you need to edit the configuration file of the SSH daemon through the local console.
Namely, check the configuration files in the directory /etc/ssh/sshd_config.d/*.conf and replace PermitRootLogin no with PermitRootLogin yes and PasswordAuthentication no with PasswordAuthentication yes
If this directory is empty, then you need to create a new file and fill it with such data
$ sudo tee /etc/ssh/sshd_config.d/60-cloudimg-settings.conf<<EOF
PermitRootLogin yes
PasswordAuthentication yes
EOF
If this directory does not exist, it must be added to the end of the main configuration file
$ sudo echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
$ sudo echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
Then restart the SSH daemon or reboot the VM
$ sudo systemctl restart ssh
or (OS dependent)
$ sudo systemctl restart sshd
