Interview Prep/Linux/Users, groups and access control

A new compliance rule says no user may reuse their last five passwords and passwords need 14+ characters. How do you enforce it?

IntermediateScenarioUsers, groups and access control
Answer

Situation read → PAM password quality and history.

What I'd do →

  1. In /etc/security/pwquality.conf: minlen = 14, minclass = 3, dictcheck = 1.
  2. For history, use pam_pwhistory. On RHEL 9 use authselect: authselect enable-feature with-pwhistory and set remember = 5 in /etc/security/pwhistory.conf.
  3. On Debian/Ubuntu add to /etc/pam.d/common-password: password required pam_pwhistory.so remember=5 use_authtok before pam_unix.
  4. Test with passwd as a normal user.

Why → pwquality checks strength at change time; pwhistory stores previous hashes in /etc/security/opasswd.

Interview tip → On RHEL, editing /etc/pam.d/system-auth directly gets overwritten by authselect.

All Linux questions Roadmap: Linux

More on Users, groups and access control