Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? I guess yes, and this may be a very stupid question...

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.