Overview
passwd is a command that manages user passwords, a core element of system security. It is essential for maintaining strong password policies and controlling account access.
Key Features
- Change current user's password
- Change another user's password with root privileges
- Lock and unlock user accounts
- Set and check password expiration
Key Options
The main options for the passwd command are primarily used when managing other user accounts with root privileges.
Account Management
Generated command:
Try combining the commands.
Description:
`passwd` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Learn how to manage passwords through various usage examples of the passwd command.
Change Your Own Password
passwd
Changes the password for the currently logged-in user. The command will prompt you to enter your current password and then the new password twice.
Change Another User's Password (root)
sudo passwd [username]
Changes the password for a specific user with root privileges. In this case, you do not need to know the current password; you only need to enter the new password twice.
Lock User Account (root)
sudo passwd -l [username]
Locks a specific user account, making it impossible to log in. Account locking is useful for temporarily blocking access without changing the password.
Unlock User Account (root)
sudo passwd -u [username]
Re-enables a locked user account, allowing the user to log in.
Check Password Status (root)
sudo passwd -S [username]
Checks the password status information for a specific user account. 'PS' indicates that a password is set, and 'L' indicates that the account is locked.
Tips & Precautions
Points to note and additional tips when using the passwd command.
Enhance Security
Always use strong and unpredictable passwords. It is recommended to combine uppercase letters, lowercase letters, numbers, and special characters, and to maintain a sufficient length.
- Minimum 8 characters, combination of uppercase, lowercase, numbers, and special characters
- Avoid dictionary words, personal information, and repeating characters
- Change passwords periodically
Importance of Root Privileges
The root user can change the passwords of all accounts on the system, so the root account's password should be set particularly strong and managed meticulously.
Related Commands
For more detailed account management, such as password expiration policies, you can use the `chage` command.
- chage: Set and check user password expiration information and policies