2.3. 创建并部署您自己的 authselect 配置集


作为系统管理员,您可以通过生成一个默认配置集的自定义副本来创建和部署自定义配置集。

当您部署自定义配置集时,配置集将应用于记录到给定主机上的每个用户。

流程

  1. 要创建自定义配置文件,请运行 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>
    Copy to Clipboard Toggle word wrap
    警告

    如果您计划修改 /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 文件的一个副本。

  2. 配置 /etc/authselect/custom/<custom_profile>/nsswitch.conf 文件。
  3. 通过运行 custom/<custom_profile> 作为参数的 authselect select 命令来选择自定义配置文件:

    # authselect select custom/<custom_profile>
    Copy to Clipboard Toggle word wrap

    为您的机器选择 <custom_profile> 配置文件意味着,如果以后红帽更新了 sssd 配置文件,您可以从所有更新(除了对 /etc/nsswitch.conf 文件所做的更新)中获益。

    根据 sssd 配置集创建自定义配置集示例:

    您可以基于 sssd 配置文件创建一个配置文件,它只咨询本地静态表来查找 /etc/hosts 文件中的主机名,而不是 dnsmyhostname 数据库中的主机名。

    1. 编辑 /etc/nsswitch.conf 文件,修改以下行:

      hosts:      files
      Copy to Clipboard Toggle word wrap
    2. 基于 sssd 创建自定义配置集,它排除了对 /etc/nsswitch.conf 的更改:

      # authselect create-profile custom-sssd-profile -b sssd --symlink-meta --symlink-pam
      Copy to Clipboard Toggle word wrap
    3. 选择配置集:

      # authselect select custom/custom-sssd-profile
      Copy to Clipboard Toggle word wrap
    4. 可选:检查选择的自定义配置文件是否已

      • 根据所选的 sssd 配置文件创建了 /etc/pam.d/system-auth 文件
      • 原封不动保留 /etc/nsswitch.conf 中的配置:

        hosts:      files
        Copy to Clipboard Toggle word wrap
        注意

        运行 authselect select sssd 将会产生 hosts: files dns myhostname

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat