本文主要是介绍创建PAM配置文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在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
- servicesMake 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.
这篇关于创建PAM配置文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!