Connection closed by <ip> [preauth]

I'm on a Ubuntu server. I'm trying to enable an ssh tunnel in order to add a git remote in a project of mine.

  • On my local win7 machine I generated the key pair with PuTTYgen.
  • I pasted the public key in authorized_keys file
  • I set the private PuTTY ppk filepath into putty Auth config

When I try to open a remote shell I get the error Server refused our key.

Checking the log: Connection closed by <ip> [preauth] in /var/log/auth.log.

More infos:

~/.ssh/authorized-keys have permissions 664.

The file is named authorized-keys not authorized_keys could this be a problem?

What am I missing?


The name should be ~/.ssh/authorized_keys instead authorized-keys. Probably somebody setting this up (for the other key) named the file wrong and was similarly wondering why it does not work.

Also the file should not be writable by anyone else but owner. Therefore the permissions should be 644 instead. You can fix that using

chmod go-w ~/.ssh/authorized_keys

This answer might be little late, but for those who seek similar issue, I would suggest best thing to copy the public key to remote server's authorized_key file is using following command:

ssh-copy-id remoteuser@remotehost

This will copy the current user's pub key to remote server and will avoid typos.

Additionally, -i flag can be used to point at different identity file.