问题已解决:是因为.ssh目录没有ssh_home_t
标签!!通过下面命令重置。参考public-key-authentication-fails-only-when-sshd-is-daemon 一次由SELinux引起的ssh公钥认证失败问题
restorecon -r -vv /root/.ssh
[root@localhost ~]# restorecon -r -vv .ssh
restorecon reset /root/.ssh context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
restorecon reset /root/.ssh/id_rsa context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
restorecon reset /root/.ssh/known_hosts context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
restorecon reset /root/.ssh/authorized_keys context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
restorecon reset /root/.ssh/id_rsa.pub context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
通过这个命令查看文件夹或文件的标签
[root@localhost ~]# ls -laZ
drwx------. root root unconfined_u:object_r:ssh_home_t:s0 .ssh