2.3. 创建并部署您自己的 authselect 配置集
作为系统管理员,您可以通过生成一个默认配置集的自定义副本来创建和部署自定义配置集。
当您部署自定义配置集时,配置集将应用于记录到给定主机上的每个用户。
流程
要创建自定义配置文件,请运行
authselect create-profile命令。将<custom_profile>替换为所需的配置文件名称。例如,要基于现有的sssd配置文件创建一个配置文件,并选择自己配置/etc/nsswitch.conf文件中的项目,请使用以下命令:authselect create-profile <custom_profile> -b sssd --symlink-meta --symlink-pam New profile was created at /etc/authselect/custom/<custom_profile>
# authselect create-profile <custom_profile> -b sssd --symlink-meta --symlink-pam New profile was created at /etc/authselect/custom/<custom_profile>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 警告如果您计划修改
/etc/authselect/custom/<custom_profile>/{password-auth,system-auth,fingerprint-auth,smartcard-auth,postlogin},然后输入以上没有--symlink-pam选项的命令。这是为了确保在升级authselect-libs过程中修改持久。命令中包含
--symlink-pam选项意味着 PAM 模板是到原始配置文件的符号链接,而不是其副本的链接;包括--symlink-meta选项意味着元文件(如 README 和 REQUIREMENTS)是到原始配置文件的符号链接,而不是其副本的链接。这确保以后对原始配置文件中 PAM 模板和 meta 文件的所有更新也会反映在您的自定义配置文件中。命令在
/etc/authselect/custom/<custom_profile>/目录中创建/etc/nsswitch.conf文件的一个副本。-
配置
/etc/authselect/custom/<custom_profile>/nsswitch.conf文件。 通过运行
custom/<custom_profile>作为参数的authselect select命令来选择自定义配置文件:authselect select custom/<custom_profile>
# authselect select custom/<custom_profile>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为您的机器选择
<custom_profile>配置文件意味着,如果以后红帽更新了sssd配置文件,您可以从所有更新(除了对/etc/nsswitch.conf文件所做的更新)中获益。根据 sssd 配置集创建自定义配置集示例:
您可以基于
sssd配置文件创建一个配置文件,它只咨询本地静态表来查找/etc/hosts文件中的主机名,而不是dns或myhostname数据库中的主机名。编辑
/etc/nsswitch.conf文件,修改以下行:hosts: files
hosts: filesCopy to Clipboard Copied! Toggle word wrap Toggle overflow 基于
sssd创建自定义配置集,它排除了对/etc/nsswitch.conf的更改:authselect create-profile custom-sssd-profile -b sssd --symlink-meta --symlink-pam
# authselect create-profile custom-sssd-profile -b sssd --symlink-meta --symlink-pamCopy to Clipboard Copied! Toggle word wrap Toggle overflow 选择配置集:
authselect select custom/custom-sssd-profile
# authselect select custom/custom-sssd-profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow 可选:检查选择的自定义配置文件是否已
-
根据所选的
sssd配置文件创建了/etc/pam.d/system-auth文件 原封不动保留
/etc/nsswitch.conf中的配置:hosts: files
hosts: filesCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意运行
authselect selectsssd将会产生hosts: files dns myhostname
-
根据所选的