Configuration Methods
Overview of Password Configuration Techniques
Password configuration in Linux can be achieved through multiple methods, each serving different administrative needs and system requirements.
1. Using chage Command
The chage
command provides direct user password aging management:
## View current password aging information
sudo chage -l username
## Set maximum password age to 90 days
sudo chage -M 90 username
## Force user to change password on next login
sudo chage -d 0 username
2. PAM (Pluggable Authentication Modules) Configuration
PAM Configuration Files
File Location |
Purpose |
/etc/pam.d/common-password |
Global password complexity rules |
/etc/login.defs |
System-wide password defaults |
Sample PAM Configuration
## Edit PAM configuration
sudo nano /etc/pam.d/common-password
## Example password complexity rule
password requisite pam_pwquality.so retry=3 minlen=12 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1
3. Direct /etc/login.defs Modifications
## Edit login configuration
sudo nano /etc/login.defs
## Example configuration parameters
PASS_MAX_DAYS 90 ## Maximum days before password expiration
PASS_MIN_DAYS 7 ## Minimum days between password changes
PASS_WARN_AGE 14 ## Days of warning before password expires
Configuration Workflow
graph TD
A[Start Password Policy Configuration] --> B{Choose Method}
B --> |chage| C[User-Specific Settings]
B --> |PAM| D[System-Wide Complexity Rules]
B --> |login.defs| E[Global Password Defaults]
C --> F[Apply Changes]
D --> F
E --> F
Best Practices for LabEx Administrators
- Use multiple configuration methods
- Implement consistent policies
- Regularly audit password settings
- Combine PAM, chage, and login.defs for comprehensive security
Verification Commands
## Verify password policy settings
sudo grep -E 'PASS_|password' /etc/login.defs
sudo cat /etc/pam.d/common-password
Advanced Configuration Techniques
- Integrate with LDAP
- Use centralized authentication systems
- Implement multi-factor authentication
By mastering these configuration methods, Linux administrators can create robust, flexible password management strategies tailored to their specific security requirements.