CentOS – Pubkey Auth在/ var中不适用于用户
过去一周左右,我一直在解决一个问题,而且我正在用尽想法。 我在我的Centos 7 VPS上为git服务器添加了一个新用户,并且(在几篇文章的build议下)将用户的主目录放在/var而不是/home 。 然后,我尝试使用SSHlogin到该用户,并正常工作。 但是 ,公钥validation无法正常工作。 在debugging过程中,我最终使git用户和主要用户以各种方式相同 – 他们都是sudoers,他们有相同的.ssh目录,具有相同的authorized_keys文件,甚至把git用户移到了/home ,但无济于事。 为了进一步testing,我创build了两个新用户: test1和test2 。 test1的主目录在/home ,而test2的主目录在/var 。 果然,pubkey auth为test1而不是test2 。 我不认为这是一个权限问题,因为/var具有与/home相同的权限,并且用户目录都具有正确的权限。 另外,我感到非常困惑,原来的git用户甚至在把它移到/home之后也不接受pubkey auth。 如果我在详细模式下运行ssh,我可以看到在发送密钥后发生劫持: debug1: Offering RSA public key: /home/user/.ssh/foo.key debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password 连接到主用户或test1 ,它的行为是不同的: debug1: Offering RSA public key: /home/user/.ssh/foo.key debug2: […]