CentOS access.conf 设置运行不正常?

CentOS access.conf 设置运行不正常?

我有一台 CentOS 机器,下面我在我的机器中设置了它access.conf

root : ALL 

但是我可以通过 root 登录并执行任务。那么,它的工作是什么access.conf?这里有什么问题吗?

答案1

在这里你可以了解如何激活 access.conf

我确实在 access.conf 文件中添加了以下内容

[root@lcoalhost ~]# tail -1 /etc/security/access.conf
-:user1:ALL

我在文件“/etc/pam.d/sshd”中添加了以下内容

[root@localhost ~]# head -3 /etc/pam.d/sshd
#%PAM-1.0
auth       include      system-auth
account    required     pam_access.so   #I added this line in the file

特别是第三行。

编辑此内容后,我尝试以用户身份访问服务器:user1:

这是我在日志文件中看到的内容“/var/log/secure”

Jan  1 16:40:06 localhost sshd[17981]: pam_access(sshd:account): access denied for user `user1' from `10.0.1.243'
Jan  1 16:40:06 localhost sshd[17981]: Failed password for user1 from 10.0.1.243 port 3186 ssh2
Jan  1 11:10:06 localhost sshd[17982]: fatal: Access denied for user user1 by PAM account configuration

此处“user1”已被拒绝任何 IP。同样,您可以对任何用户执行此操作。

root这是用户的日志

Jan  1 16:53:29 localhost sshd[19144]: pam_access(sshd:account): access denied for user `root' from `10.0.1.243'
Jan  1 16:53:29 localhost sshd[19144]: Failed password for root from 10.0.1.243 port 3356 ssh2
Jan  1 11:23:29 localhost sshd[19145]: fatal: Access denied for user root by PAM account configuration

希望这可以帮助。

相关内容