I want root user to be able to login via ssh key authentication. How can I get that done? I tried changing the ssh config file and adding PermitRootLogin without-password but that didn't work. I also tried reload sshd. I'm using centos 6.

  • what do you see in the server error log (/var/log/secure)? Did you restart your sshd service? – Jakuje Mar 11 '16 at 17:37
  • 1
    Besides setting PermitRootLogin to yes and restarting sshd, you copied your public key into /root/.sshd/authorized_keys (which has rights 600), didn't you? – Gombai Sándor Mar 11 '16 at 22:34

Assuming you have done everything right (as per comments above), and it still doesn't work - the problem (and I hit it regularly) relates to SELinux rules.

You can check that this is the case by [ temporarily ? ] disabling SELinux by "echo 0 > /selinux/enforcing" and see if things start working.

Apparently the solution would be to log in to the box and run "restorecon -R -v /root/.ssh" (I confess to not doing it this way, I just used corepolicyutils and made a ssh.pe file which I copy and load on each system which has this problem).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.