I placed my public key, I believe, on my server account (I do not have root) in .ssh/authorized_keys2. Now where it used to ask me for my password it just says "Connection closed." I cannot log in. Ideas?

  • Do you have another account or client ip that you can try? It sounds like permissions for your user or your IP address has been removed. (see the /etc/ssh/sshd_config, if possible) – keithosu Sep 12 '09 at 0:44

Usually the filename .ssh/authorized_keys (without 2) should also do nowadays. Additionally check that the authorized_keys file is not world- or group-readable, neither the .ssh dir should be.

Logging in with ssh -vvv could give you some more clues. But most times I encounter this it's just due to wrong permissions.

Edit: Try to login without even utilitizing the key by temporary moving your private key away... Maybe something went just terribly wrong when you pasted the public key to the server.

| improve this answer | |

Sounds like a permissions problem. Chances are that the ssh server is unable to read .ssh/authorized_keys2 and crashing out when it tries to do that. Do what hurikhan said and do a ssh -vvv to get some verbose errors and trace at which point the connection is broken.

| improve this answer | |
  • This was my first thought as well upon reading the question. SSH is very particular about the permissions and ownership of the .ssh directory itself and the authorized keys files (.authorized_keys & .authorized_keys2). – Jeremy Bouse Sep 12 '09 at 14:20

To ensure that the permissions are set correctly, run the following command:

chmod -R go-rwx /home/john/.ssh

(remove rwx privileges from group and other)

| improve this answer | |

Your Answer

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