My server only allowed passwordless root login via ssh. For example, ssh root@myserver.com would get me right in. I wanted to enable user login, e.g. ssh special_user@myserver.com would ask for a password.

I edited the sshd_config file by commenting out the line:

AuthorizedKeysFile %h/.ssh/authorized_keys

to read:

#AuthorizedKeysFile .ssh/authorized_keys

and restarted the ssh server

/etc/init.d/ssh restart

I was immediately kicked off of the server, and now when I enter either root@myserver.com or special_user@myserver.com, I get this error:

ssh: connect to host myserver.com port 22: Connection refused

Is there any way to get ssh access back into my server, and potentially enable user logins?


Connection Refused is a TCP level error meaning that there is no service bound to port 22. Simply put, the ssh server is no longer running.

Your best bet for recovery here is going to be a physical terminal, it seems as if you may have a corrupt sshd_config file, and the server failed to restart.

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.