If you’ve installed the official CentOS image, after trying to login as root you will see the following message: “Please login as the user “centos” rather than the user “root”. Here is how to permit root login in CentOS:
- Login as “centos” user and switch to root: sudo -s
- nano /root/.ssh/authorized_keys and remove everything before “sh-rsa”
- nano /etc/ssh/sshd_config and uncomment the line “PermitRootLogin yes”
- systemctl restart sshd