2.4. 创建并部署您自己的 authselect 配置集
作为系统管理员,您可以通过生成一个默认配置集的自定义副本来创建和部署自定义配置集。
这在修改一个现成的 authselect 配置集不足以满足您的需要时特别有用。当您部署自定义配置集时,配置集将应用于记录到给定主机上的每个用户。
流程
要创建自定义配置集,请运行
authselect create-profile
命令。将<custom_profile
> 替换为所需的配置集名称。例如,要基于 ready-madesssd
配置集创建一个配置集,并有选项来自行配置/etc/nsswitch.conf
文件中的项目,请使用以下命令:authselect create-profile <custom_profile> -b sssd --symlink-meta --symlink-pam
# 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
文件的更新除外。例 2.1. 根据 sssd 配置集创建自定义配置集
您可以基于
sssd
配置集创建一个配置集,它只查询/etc/hosts
文件中的本地静态表查找主机名,而不在dns
或myhostname
数据库中查询。编辑
/etc/nsswitch.conf
文件,修改以下行:hosts: files
hosts: files
Copy 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-pam
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 选择配置集:
authselect select custom/custom-sssd-profile
# authselect select custom/custom-sssd-profile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 可选:检查选择自定义配置集是否有
-
根据所选的
sssd
配置文件创建了/etc/pam.d/system-auth
文件 原封不动保留
/etc/nsswitch.conf
中的配置:hosts: files
hosts: files
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意运行
authselect select
sssd
将会产生hosts: files dns myhostname
-
根据所选的