在RHEL8中,PAM的一些配置文件由authselect管理,/etc/pam.d/system-auth
和/etc/pam.d/password-auth
分别是/etc/authselect/system-auth
和/etc/authselect/password-auth
的符号链接。
由于不建议直接更改上述文件,因此我们计划复制默认配置文件的sssd并更改该配置文件,以定制系统的认证配置和行为。
配置文件创建方法如下(在以下实例中,配置文件名称为user-profile)
创建一个名为 user-profile
的自定义认证配置文件,并指定使用 SSSD 后端。这个命令会在 /etc/authselect/custom/
目录下创建一个新的配置文件,具体路径为 /etc/authselect/custom/user-profile
。
[root@localhost ~]# authselect create-profile user-profile -b sssd
New profile was created at /etc/authselect/custom/user-profile
选择创建的配置文件
命令再次选择名为 custom/user-profile
的认证配置文件,并启用 with-silent-lastlog
选项,即启用静默最后登录消息功能。
[root@localhost ~]# authselect select custom/user-profile with-silent-lastlog
Profile "custom/user-profile" was selected.
The following nsswitch maps are overwritten by the profile:
- passwd
- group
- netgroup
- automount
- services
Make sure that SSSD service is configured and enabled. See SSSD documentation for more information.
生效配置
如果在选择配置文件之后更改了user-profile
的PAM配置文件(system-auth
、password-auth
),需要执行下面的命令使其生效。使用此命令,会将/etc/authselect/custom/user-profile
下的system-auth
和password-auth
设置反映在/etc/authselect/system-auth
和/etc/authselect/password-auth
中。
[root@localhost ~]# authselect apply-changes
Changes were successfully applied.