I've set up a user with a home directory like this:

|- .ssh/
|-- authorized_keys

I've added the private key to my local bash, and the public key to the authorized_keys file on the remote machine.

I know the keys work, because I tried to add the public key to the another users authorized_keys file, and it logged me in. It is just when I try with the user I just made that it doesn't work.

The .ssh/ have permissions 700, and the authorized_keys have permissions 600, and both are owned by the user I created.

When I run ssh [myuser]@[thedomain] -v, it tells me in the 2 last lines:

debug1: No more authentication methods to try.
Permission denied (publickey).

However, on the other user I can log right in, so it can find the key on my machine.

It is like it can't find the public key on the remote machine. The remote machine is running Ubuntu.

This is from /etc/passwd:


This is from /var/log/auth.log:

Aug 26 14:11:17 fra sshd[32172]: Connection closed by <my ip address> [preauth]

EDIT: I tried to create a different user with a different user name, and it worked. Are there any reserved user names?

  • What does the /var/log/auth.log tell on the server side? – Tero Kilkanen Aug 26 '16 at 12:07
  • @TeroKilkanen I added it to the post. – ptf Aug 26 '16 at 12:13
  • Check if there are differences in those two users (you can update your post with /etc/password from user that can connect). Other than that, check sshd_config and see if you have allowed access to selected users with AllowUsers option – RonanW. Aug 26 '16 at 13:32
  • Well, I deleted the user. I know the AllowUsers option wasn't specified, so everyone should have had permission to connect with ssh. – ptf Aug 26 '16 at 14:14
  • The permissions of the home directory of your user? – Jakuje Aug 26 '16 at 15:27

Your Answer

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

Browse other questions tagged or ask your own question.