Create a home directory export on a separate server.Create a second, local home directory on the test CentOS 7 server.Make sure the local and NFS homedirs have the same UID, GID and permissions.Put the same .ssh/authorized_keys file, using a public key from the test account on a third server.SSHD via systemctl looks for $OPTIONS, but the variable is not set in /etc/sysconfig/sshd.Case 1: Test SSH login using the local homedir. No password required.Case 2: Test SSH login using the NFS/autofs homedir. authorized_keys gets ignored, but password works.Case 3: systemctl stop sshd and /usr/sbin/sshd to start SSHD in the foreground. No password required with either homedir.So, something is weird about the combination of the systemctl started SSHD and NFS/autofs homedirs?What am I missing?
CentOS 7 SSHD and automounted home directories?
centos;nfs;sshd;automounting
It was an SELinux thing. Get onto the NFS server and executesemanage fcontext -a -t ssh_home_t '/exports/[^/]+/\.ssh(/.*)?'restorecon -v -r /exports/$USERassuming you serve your NFS shares from `/exports'.