My root user can login using ssh but for some reason my newuser can't login using the same key. I'm using putty and these are the messages I got.

Console message: Using username 'newuser'. Server refused our key

Putty Message: Disconnected: No supported authentication methods available (server sent: publickey)

On my server I created a key file here /home/newuser/.ssh/authorized_keys and I pasted my SSH key into that file. In addition I've browsed on my windows machine and attached the file in putty.

I'm pulling my hair out. I'm not quite sure where to look to find the problem. Is there something obvious I might be missing?

---- update ----

I logged into my root account and attempted to switch to newuser by typing ssh newuser@my.ip.address and no luck. I got this message, Permission denied (publickey).

  • 1
    What does /var/log/auth.log say? – ceejayoz Nov 29 '17 at 2:53
  • @ceejayoz thanks so much I checked the auth.log but it is huge. What should I look for? – DR01D Nov 29 '17 at 3:48
  • 1
    tail -f the auth.log, then attempt to connect again. See what new lines pop up. – ceejayoz Nov 29 '17 at 3:59
  • Cool! Being a noob I haven't used tail -f before. I looked in the log but didn't necessarily see anything. However I did find my error. root owned authorized_keys. When I used chmod to assign ownership to newuser it fixed the problem on the spot. – DR01D Nov 29 '17 at 5:28

I found the problem.

authorized_keys was owned by root because that is the user that created it. I used chown to switch ownership to newuser and it fixed the problem on the spot.

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.