I'm trying to connect to a sftp server via sftp USERNAME@SERVERNAME. Whatever I do, I get "Permission denied (publickey)." Googling doesn't help as everybody recommends switching to key-based authentication, which is a funny idea for somebody not in control over the server. But maybe the server has been switched in the meantime (and nobody told me). Using -v I get:

debug1: Host HOSTNAME is known and matches the RSA host key.
debug1: Found key in .../.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: .../.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentications that can continue: publickey
debug1: Trying private key: .../.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Couldn't read packet: Connection reset by peer

Does it mean that the server accepts no passwords at all?


Authentications that can continue: publickey

The first instance of the “Authentications that can continue” message only lists public keys. So the server is set up not to accept any other authentication method such as passwords.

If the server accepted passwords as well, you'd instead see:

Authentications that can continue: publickey,password

You'll need to ask the system administrator to add your public key to the authorized_keys file for the account, or to reenable password authentication for you in sshd_config.

| improve this answer | |

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.