Starting today, when I try to connect to my CentOS VM as root, using Putty, or indeed any SSH client, I can no longer login. The connection is made, but the login itself fails. I know for a fact that I am typing the correct password, because it works when I login directly to the VM itself.

Using a backup that I made a few weeks ago, I can SSH with no problems. This really only started happening today.

I've already made some research on this, and:

  • my log files aren't updated with anything when the SSH login is failed
  • during connection, using -vvv to get information on the login process, the only difference between my backup login and my current VM process is that, after I type my password, my current VM shows debug3: receive packet: type 51. That's it. It just keeps asking me for a password, over and over.
  • The sshd_config is properly set up, permitting root login and all.

Again, this worked perfectly fine yesterday, and looking at my command history I can't see much of anything that might have broken SSHD. Only cats and tails and at worst apachectl restarts And the VM is locally hosted, only I have access to it because it can't be run while my PC is shut down.

I just don't get what happened. Did some file happen to get corrupted? Is this fixable whatsoever? My backup is missing some configs that I really don't feel like setting up again.

EDIT: Logging as a different user DOES work. I can then use sudo -i to become root. It'll do for now, but I'm not marking this "solved" until I actually find the real solution.

  • 1
    Did You try to log in with a different user?
    – EOhm
    Commented Oct 23, 2019 at 9:14
  • @EOhm yes, logging as a different user does work
    – Grumbunks
    Commented Oct 23, 2019 at 9:21
  • So You find entries in secure.log for the other user but not for root? I think by default config for each login try there is a secure.log entry. But not certain whether there is one if sshd itself blocks root login. So I guess it can only be related to the permit root login setting in sshd config. But You told You checked that already (so it's explicitly allowing password login for root), I have no idea if neither secure.log entry visible nor explicit allowance for password based root login missing.
    – EOhm
    Commented Oct 23, 2019 at 9:40
  • Maybe raise log level of sshd or even start it in console with verbose mode. Also try whether it's working with selinux disabled, just in case selinux is Your friend here .
    – EOhm
    Commented Oct 23, 2019 at 9:41

2 Answers 2


If you happen to change any SELinux policy for root, it might have wiped off authorizations.

You can copy the authorization file from any other server to this or use the one for any other user. You can also generate new using keygen.

The ssh keys are stored in:


And for root


In the end, SSH did work -- the problem didn't lie with SSH's config but with the VM's interfaces. One of the interfaces used an IP address that was used by another VM on the network -- so, when I tried to SSH to it, I couldn't log in as root because I was indeed using the wrong password.

I fixed this by restarting the VM and rebooting my PC multiple times until its interface was given a new IP, to which I could connect.

However the VM itself was corrupted or broken to a degree (apache was extremely slow, the guilty interface mentioned above lost its IP address and constantly refused to be activated again using ifup, so I just ended up giving up and using my backup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .