【问题标题】:How to set up diferent password rules for regular users and for root on PAM如何在 PAM 上为普通用户和 root 设置不同的密码规则
【发布时间】:2021-12-24 00:07:36
【问题描述】:

请稍等片刻。我正在做一个大学练习来设置一个虚拟机,我很难理解 PAM 是什么以及实际工作。 google 上的所有结果要么太基本,要么太复杂,我真的不知道要查找什么。我的练习要求我为普通用户和 root 用户设置一堆规则:

要设置强密码策略,您必须遵守以下要求:

  • 您的密码长度必须至少为 10 个字符。
  • 必须包含一个大写字母和一个数字。
  • 它不能包含超过 3 个连续的相同字符。
  • 密码不能包含用户名。
  • 以下规则不适用于 root 密码:密码必须 至少有 7 个字符不属于前者 密码。
  • 当然,您的 root 密码必须符合此政策

我找不到任何好的网站来解释 PAM 如何以一种好的方式工作,但是我发现对于普通用户,我需要编辑 /etc/pam.d/common-password

password        requisite          pam_pwquality.so retry=3 minlen=10 ucredit=-1 dcredit=-1 maxrepeat=3 reject_username difok=7 enforce_for_root

虽然我不了解 PAM 的工作原理,但我确实了解它的标志。 我的问题是如何为 root 设置不同的规则?

【问题讨论】:

    标签: passwords debian root pam


    【解决方案1】:

    Note that root is not asked for an old password so the checks that compare the old and new password are not performed. 所以,基本上,这句话

    以下规则不适用于root密码

    意味着你不能让 difok=7 为 root 工作,不是你必须为 root 创建一个单独的规则。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-18
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 2019-09-21
      相关资源
      最近更新 更多