passwd
Overview
The passwd
command changes user account passwords. It’s used to change passwords, update password expiry information, and manage account locking.
Syntax
passwd [options] [LOGIN]
Common Options
Option | Description |
---|---|
-d, --delete |
Delete password |
-e, --expire |
Force password expiration |
-i, --inactive DAYS |
Set password inactive days |
-l, --lock |
Lock password |
-n, --minimum DAYS |
Set minimum days |
-S, --status |
Password status report |
-u, --unlock |
Unlock password |
-w, --warning DAYS |
Set expiry warning |
-x, --maximum DAYS |
Set maximum days |
-h, --help |
Display help |
Key Use Cases
- Password management
- Account security
- Access control
- Security maintenance
- User administration
Examples with Explanations
Example 1: Change Password
passwd
Change own password
Example 2: User Password
sudo passwd username
Change specific user’s password
Example 3: Account Status
passwd -S username
Show password status
Understanding Output
Password status format:
username Status Last_Change Min_Days Max_Days Warn_Days Inactive Lock_Date
Status codes: - P: usable password - L: locked password - NP: no password
Common Usage Patterns
Force password change:
passwd -e username
Lock account:
passwd -l username
Set expiry:
passwd -x 90 -w 7 username
Security Considerations
- Password complexity
- Expiry policies
- Account locking
- Access control
- Audit logging
Additional Resources
Best Practices
- Regular changes
- Strong policies
- Expiry management
- Access monitoring
- Security audits
Password Policies
- Minimum length
- Complexity rules
- History control
- Expiry periods
- Failed attempts
Troubleshooting
- Password errors
- Account lockouts
- Expiry issues
- Permission problems
- Policy conflicts