共享 /home 和 OpenLDAP 的 SSH 密钥身份验证失败

SSH Key Authentication failure with shared /home and OpenLDAP

对于我们的网络,我们让用户完全通过 OpenLDAP 进行管理,并且主目录是使用 NFS 从中央服务器安装的。服务器 A 是主服务器,它是本地 /home 所在的位置,它运行 OpenLDAP 服务器。服务器 B 安装了它,用户可以使用 SSH 密钥正常登录。用户也可以在服务器 A 上使用 SSH 密钥登录。

服务器 C 的设置方式与服务器 B 完全相同。用户可以使用其 OpenLDAP 创建的凭证、ssh 登录,并且他们的 /home 已正确挂载。但是,他们无法使用他们的 ssh 密钥。他们需要提交密码。

服务器B和C之间几乎所有的配置文件都是一样的。所有服务器都是 运行 CentOS7 并且具有相同的 /etc/nsswitch.conf、/etc/ssh/sshd_config、/etc/nslcd.conf、system-auth 和 sshd PAM 文件。

知道问题出在哪里吗?

编辑:

SSH 的详细输出在服务器 B 上如下所示: debug1: Offering RSA public key: /home/me/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: pkalg ssh-rsa blen 279 但是在 C 上,同一部分的输出没有给出对密钥的回复: debug1: Offering RSA public key: /home/me/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password

为了进一步增加怪异,尝试使用 C 上的详细标志手动启动 sshd。它似乎只在 systemd 自动化时发生。

看起来问题出在 SELinux 上。如果有人遇到同样的问题,下面的帖子会很有帮助。

https://serverfault.com/questions/321534/public-key-authentication-fails-only-when-sshd-is-daemon