0

Ubuntu 14.04LTS running openssh. I'm getting a Permission denied (public key) when I try to ssh in using my public key.

/var/log/auth.log shows "Could not open authorized keys '/home/wolfgeek/.ssh/authorized_keys': Permission denied"

HERE IS THE STRANGE PART!

If I do "ls -l /home/wolfgeek/.ssh/authorized_keys" or "stat /home/wolfgeek/.ssh/authorized_keys", I can then successfully log in via ssh. I have not changed the permissions on the file (600) nor on the .ssh directory (700). I have not modified the file, nor restarted sshd. All I do is stat the file and it starts working.

Any ideas?

  • Is this /home/wolfgeek/.ssh directory on an NFS volume? Or some other shared filesystem or unusual (for unix) filesystem type? It's possible that the OS is caching file attributes and not seeing changes to the file right away. – Kenster Jul 25 '14 at 20:11
  • Nope, it's a standard ext4 filesystem. Neither the file nor the permissions change between when it works and when it doesn't. After doing the ls -l, it works for some amount of time (like 20 mins or so) and then stops working again. – wolfgeek Jul 25 '14 at 20:15
0

the file should be 600, the directory 700.

chmod go-w ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

That the permissions formula I always use. I'm running debian, but should work the same for ubuntu

  • Nope, that didn't fix it. I already had those permissions. – wolfgeek Jul 25 '14 at 20:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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