Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

20.2. 管理用户、主机和服务的 Kerberos 主要别名

当您创建新用户、主机或服务时,会自动添加采用以下格式的 Kerberos 主体:
  • user_name@REALM
  • host/host_name@REALM
  • service_name/host_name@REALM
在某些情况下,管理员最好使用户、主机或服务能够使用别名与 Kerberos 应用程序进行身份验证,例如:
  • 用户名已更改,但该用户应当能使用之前和新用户名进行登录。
  • 即使 IdM Kerberos 域与电子邮件域不同,用户也需要使用电子邮件地址登录。
请注意,如果您重命名了一个用户,对象会保留别名和之前的规范主名称。

20.2.1. Kerberos 主要别名

添加 Kerberos 主体别名

要将别名名称 useralias 添加到帐户 用户,请输入:
[root@ipaserver ~]# ipa user-add-principal user useralias
--------------------------------
Added new aliases to user "user"
--------------------------------
         User login: user
    Principal alias: user@IDM.EXAMPLE.COM, useralias@IDM.EXAMPLE.COM
要为主机或服务添加别名,请分别使用 ipa host-add-principalipa service-add-principal 命令。
如果您使用别名名称进行验证,请将 -C 选项传给 kinit 命令:
[root@ipaserver ~]# kinit -C useralias
Password for user@IDM.EXAMPLE.COM:

删除 Kerberos 主体别名

要从帐户用户中删除别名 user alias,请输入:
[root@ipaserver ~]# ipa user-remove-principal user useralias
--------------------------------
Removed aliases from user "user"
--------------------------------
  User login: user
  Principal alias: user@IDM.EXAMPLE.COM
要从主机或服务中删除别名,请分别使用 ipa host-remove-principalipa service-remove-principal 命令。
请注意,您无法删除规范的主名称:
[root@ipaserver ~]# ipa user-show user
  User login: user
  ...
  Principal name: user@IDM.EXAMPLE.COM
  ...

[root@ipaserver ~]# ipa user-remove-principal user user
ipa: ERROR: invalid 'krbprincipalname': at least one value equal to the canonical principal name must be present

20.2.2. Kerberos Enterprise Principal Alias

企业级别名可以使用任何域后缀,但用户主体名称(UPN)后缀、NetBIOS 名称或可信 Active Directory 林域的域名除外。
注意
在添加或删除企业主体别名时,请使用两个反斜杠(\\)转义 @ 符号。否则,shell 会将 @ 符号解析为 Kerberos 域名称的一部分,并导致以下错误:
ipa: ERROR: The realm for the principal does not match the realm for this IPA server

添加 Kerberos 企业主要别名

将企业主体别名 user@example.com 添加到 用户帐户 中:
[root@ipaserver ~]# ipa user-add-principal user user\\@example.com
--------------------------------
Added new aliases to user "user"
--------------------------------
         User login: user
    Principal alias: user@IDM.EXAMPLE.COM, user\@example.com@IDM.EXAMPLE.COM
要为主机或服务添加企业别名,请分别使用 ipa host-add-principalipa service-add-principal 命令。
如果您使用企业主体名称进行验证,请将 -E 选项传给 kinit 命令:
[root@ipaserver ~]# kinit -E user@example.com
Password for user\@example.com@IDM.EXAMPLE.COM:

删除 Kerberos 企业主要别名

要从帐户 用户 中删除企业主体别名 user@example.com,请输入:
[root@ipaserver ~]# ipa user-remove-principal user user\\@example.com
--------------------------------
Removed aliases from user "user"
--------------------------------
  User login: user
  Principal alias: user@IDM.EXAMPLE.COM
要从主机或服务中删除别名,请分别使用 ipa host-remove-principalipa service-remove-principal 命令。