passwd
Overview
The passwd
command changes user password. It modifies the password for user accounts and can also change account information.
Syntax
passwd [options] [username]
Common Options
Option | Description |
---|---|
-d |
Delete password |
-e |
Expire password |
-i days |
Inactive days |
-l |
Lock account |
-n days |
Minimum days |
-S |
Status report |
-u |
Unlock account |
-w days |
Warning days |
-x days |
Maximum days |
--stdin |
Read from stdin |
Configuration Files
File | Description |
---|---|
/etc/passwd | User accounts |
/etc/shadow | Password data |
/etc/pam.d/passwd | PAM config |
/etc/login.defs | Login defaults |
/etc/security/pwquality.conf | Password quality |
Key Use Cases
- Password changes
- Account security
- Password policy
- Account locking
- Security management
Examples with Explanations
Example 1: Change Password
passwd
Change own password
Example 2: User Password
passwd username
Change user’s password
Example 3: Lock Account
passwd -l username
Lock user account
Common Usage Patterns
Self change:
passwd
User change:
passwd user
Account status:
passwd -S user
Security Considerations
- Password strength
- Account access
- Expiry policy
- Lock control
- Password history
Additional Resources
Best Practices
- Strong passwords
- Regular changes
- Policy compliance
- Access control
- Documentation
Password Management
- Password changes
- Account security
- Policy enforcement
- Access control
- Security audit
Troubleshooting
- Password errors
- Lock issues
- Policy conflicts
- Access problems
- System errors
Common Issues
- Weak passwords
- Policy violations
- Lock problems
- Access denied
- System conflicts