2

I can't setup public key authentication for one particular user on a system. I checked user home and .ssh directories permissions, and it's good (drwx------. both, the same as for other users that can auth by public key). I found somewhere in the internets an advice to stop sshd and run it with -ddd option to get some more information (sudo /usr/sbin/sshd -ddd). The weird thing that if I run it that way then it's working for the user.

Any ideas on this strange behavior?

3
  • are the file ownerships correct?
    – Ben Plont
    Nov 15, 2013 at 6:38
  • Also, you said you checked directory permissions, but did you also check key permission in the user's .ssh directory? If all fails, issue a different key. Nov 15, 2013 at 6:45
  • Yes, it is correct.
    – Soid
    Nov 15, 2013 at 7:02

2 Answers 2

4

Try the proper SELinux file security context.

# restorecon -Rv /home/troubleduser/.ssh
0

Turned out it was SELinux (Security Enhanced Linux) preventing sshd reading authorization keys in user's directory. I checked that it was enabled with sestatus, I disabled it with echo 0 >/selinux/enforce and it started to work. I disabled it permanently in /etc/selinux/config

1
  • 2
    Ouch! Now all nefarious insiders have SELinux disabled access. How about changing the SELinux context of the appropriate files instead and re-enabling SELinux?
    – rickhg12hs
    Nov 15, 2013 at 7:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .