In server's auth.log:

Failed publickey for agladysh from MYIP port 61313 ssh2

In ssh -vvv:

debug1: Offering public key: /Users/agladysh/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp FINGERPRINT
debug3: sign_and_send_pubkey
Connection closed by SERVER

I triple-checked the authorized_keys.

I also checked:

  • hosts.deny file for my IP
  • AllowUsers in SSH config
  • my default shell on server

Any hints how to debug this?

Server: Ubuntu Server 11.04, client: Ubuntu 10.10 (key is forwarded from OS X, works on other servers).

3 Answers 3


The actual problem was that my user was somehow missing from `/etc/shadow.

I will let this question to stay open for sometime so that people can put more troubleshooting advice here.

  • Same symptoms here, solution: Case-sensitive user name. As soon as I capitalized the user name everything worked. Might be a busybox/ash thing.
    – Riley
    Mar 24, 2015 at 19:56
  • I restored my system but because this specific user wasn't part of the original backup, even though the user existed it was not in the shadow file like you mention... thank you.
    – BrianBlaze
    Feb 14, 2023 at 16:20

Also, make sure the permissions on ~/.ssh are 700 and ~/.ssh/authorized_keys is 600. The server won't let you use the key if the permissions are incorrect.


In /etc/shadow you can lock users with * or !, like described here. A locked user will lead to a similar error message with Server accepts key... followed by Connection closed...

You must log in to answer this question.

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