如果 PAM 配置正确,则可以采用以下两种方法来更改 Kerberos 口令:
使用常见的 UNIX passwd 命令。配置 Kerberos 服务后,Solaris passwd 命令还会自动提示您输入新的 Kerberos 口令。
使用 passwd 而非 kpasswd 的优点在于可以同时设置 UNIX 口令和 Kerberos 口令。但是,在一般情况下,无需使用 passwd 同时更改这两个口令。通常,只能更改 UNIX 口令并保持 Kerberos 口令不变,反之亦然。
passwd 的行为取决于 PAM 模块的配置方式。在某些配置中,可能会要求您同时更改这两个口令。对于一些站点,必须更改 UNIX 口令,而对于其他站点,则要求更改 Kerberos 口令。
使用 kpasswd 命令。kpasswd 与 passwd 非常类似。这两个命令的一个区别是 kpasswd 仅更改 Kerberos 口令。如果要更改 UNIX 口令,则必须使用 passwd。
另一个区别是 kpasswd 可以更改非有效 UNIX 用户的 Kerberos 主体的口令。例如,david/admin 是 Kerberos 主体,但不是实际的 UNIX 用户,因此必须使用 kpasswd 而非 passwd。
更改口令后,所做更改在系统中传播需要一些时间(尤其是通过大型网络传播)。此延迟可能需要几分钟到一个小时或更长时间,具体取决于系统的设置方式。如果需要在更改口令后立刻获取新的 Kerberos 票证,请首先尝试新口令。如果新口令无效,请使用旧口令重试。
通过 Kerberos V5 协议,系统管理员可以设置允许每个用户使用的口令的条件。此类条件由为每个用户设置的策略(或缺省策略)定义。有关策略的更多信息,请参见管理 Kerberos 策略。
例如,假定用户 jennifer 的策略(称为 jenpol)要求口令长度至少为八个字母,并且至少由两种类型的字符混合组成。这样,kpasswd 便会拒绝尝试使用 "sloth" 作为口令。
% kpasswd kpasswd: Changing password for jennifer@ENG.EXAMPLE.COM. Old password: <Jennifer types her existing password> kpasswd: jennifer@ENG.EXAMPLE.COM's password is controlled by the policy jenpol which requires a minimum of 8 characters from at least 2 classes (the five classes are lowercase, uppercase, numbers, punctuation, and all other characters). New password: <Jennifer types 'sloth'> New password (again): <Jennifer re-types 'sloth'> kpasswd: New password is too short. Please choose a password which is at least 4 characters long. |
在以下示例中,jennifer 使用 "slothrop49" 作为口令。由于 "slothrop49" 的长度超过八个字母,并且包含两种不同类型的字符(数字和小写字母),因此此口令符合条件。
% kpasswd kpasswd: Changing password for jennifer@ENG.EXAMPLE.COM. Old password: <Jennifer types her existing password> kpasswd: jennifer@ENG.EXAMPLE.COM's password is controlled by the policy jenpol which requires a minimum of 8 characters from at least 2 classes (the five classes are lowercase, uppercase, numbers, punctuation, and all other characters). New password: <Jennifer types 'slothrop49'> New password (again): <Jennifer re-types 'slothrop49'> Kerberos password changed. |
在以下示例中,用户 david 使用 passwd 同时更改其 UNIX 口令和 Kerberos 口令。
% passwd passwd: Changing password for david Enter login (NIS+) password: <Type the current UNIX password> New password: <Type the new UNIX password> Re-enter password: <Confirm the new UNIX password> Old KRB5 password: <Type the current Kerberos password> New KRB5 password: <Type the new Kerberos password> Re-enter new KRB5 password: <Confirm the new Kerberos password> |
请注意,passwd 需要 UNIX 口令和 Kerberos 口令。此行为由缺省配置确定。在这种情况下,用户 david 必须使用 kpasswd 将其 Kerberos 口令设置为其他内容,如下所示。
本示例说明用户 david 如何使用 kpasswd 仅更改其 Kerberos 口令。
% kpasswd kpasswd: Changing password for david@ENG.EXAMPLE.COM. Old password: <Type the current Kerberos password> New password: <Type the new Kerberos password> New password (again): <Confirm the new Kerberos password> Kerberos password changed. |
在本示例中,用户 david 更改了 Kerberos 主体 david/admin(非有效的 UNIX 用户)的口令。该用户必须使用 kpasswd。
% kpasswd david/admin kpasswd: Changing password for david/admin. Old password: <Type the current Kerberos password> New password: <Type the new Kerberos password> New password (again): <Type the new Kerberos password> Kerberos password changed. |