Permit Root login in CentOS

Permit Root login in CentOS

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:

  1. Login as “centos” user and switch to root: sudo -s
  2. nano /root/.ssh/authorized_keys and remove everything before “sh-rsa”
  3. nano /etc/ssh/sshd_config and uncomment the line “PermitRootLogin yes”
  4. systemctl restart sshd
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.