# Ensure pam_pwhistory Module Is Enabled

- Source: https://support.icompaas.com/support/solutions/articles/62000235459-ensure-pam-pwhistory-module-is-enabled
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Amazon Linux 2 Benchmark v3.0.0](https://support.icompaas.com/support/solutions/62000112696) › [CIS Amazon Linux 2 Benchmarks](https://support.icompaas.com/support/solutions/folders/62000169265)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Profile Applicability:** • Level 1

**Description:**  
 The pam\_pwhistory module tracks users' previous passwords and prevents reuse of recent passwords. Enabling this module helps enforce password uniqueness, reducing the risk of password cycling attacks.

**Rationale:** Preventing reuse of recent passwords enhances password security by ensuring users regularly change their passwords to new, unique values.

**Impact:** Pros:

-   Enforces password uniqueness and strengthens password policies.  
    
-   Helps prevent common password reuse vulnerabilities.  
    

Cons:

-   May increase password management overhead for users.  
    

**Default Value:** The pam\_pwhistory module may not be enabled by default and requires explicit configuration.

**Pre-requisites:**

-   Root or sudo privileges to modify PAM configuration.  
    

**Remediation:**

### **Test Plan:**

**Using Linux command line:**

1.  Check PAM configuration files (e.g., /etc/pam.d/system-auth or /etc/pam.d/common-password) for pam\_pwhistory module:  
    
    grep pam\_pwhistory /etc/pam.d/system-auth  
    grep pam\_pwhistory /etc/pam.d/common-password
    
      
    
2.  Verify the module is present and configured with appropriate options.  
    

### **Implementation Plan:**

**Using Linux command line:**

1\. Edit PAM password configuration file:  

vi /etc/pam.d/system-auth

2\. Add or ensure the following line exists to enable pam\_pwhistory:  

password required pam\_pwhistory.so use\_authok remember=5 enforce\_for\_root

-   remember=5 prevents reuse of the last 5 passwords.
    
-   enforce\_for\_root applies the policy to the root user.
    

2.  Save the file.  
    

### Backout Plan:

Using Linux command line:

1.  Remove or comment out the pam\_pwhistory line if needed.
    
2.  Test password changes to verify the impact.  
    

**References:**

-   CIS Amazon Linux 2 Benchmark v3.0.0  
    
-   pam\_pwhistory Documentation  
    
-   [NIST SP 800-63B - Digital Identity Guidelines  
      
    ](https://pages.nist.gov/800-63-3/sp800-63b.html)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
