Linux passwd Command: Change a User Password
passwd is a command that interactively changes your account password. If you have administrator privileges, you can also change the passwords of other accounts, but you must verify the target account.
What is the passwd command?
Normal users usually enter their current password followed by the new password in sequence. It is normal if characters are not displayed on the screen during input. Actual validation policies and storage locations are influenced by PAM settings and the distribution's policies.
Basic syntax
passwd [option] [user]
Installed implementations and options may vary depending on the distribution. Check the current system's description with man passwd.
Examples
Changing your own password
Follow the interactive prompts to enter your current password and new password.
passwd
Changing another account's password
The administrator executes it after accurately confirming the target username.
sudo passwd alice
Check Password Status
Summarize the password status and expiration information of an account with administrative privileges.
sudo passwd -S alice
Interactive Change Process and Verification
General users usually change their account passwords with passwd. When executing the command, prompts asking for the current password and the new password may appear in order.
passwd
Example screen (phrases may vary depending on the distribution and account policy):
Current password: New password: Retype new password: passwd: password updated successfully
It can be normal if letters or asterisks do not appear on the terminal when entering the password. Do not put the actual password in command arguments or documentation examples. Changing another user's password with an administrator account affects account policies and audit records, so double-check the target name and perform the task only with the necessary permissions.
Main Options and Format
| Options/Format | Description |
|---|---|
-S |
Summarize the password status of the account. |
-l |
Lock password authentication. This does not block all other login methods. |
-u |
Unlock the locked password authentication. |
-e |
Expire the password to require a change at the next login. |
Precautions when using
Do not write the password directly in the command arguments. It can be exposed in shell history or process lists. passwd -l locks password-based authentication but does not necessarily block other authentication methods like SSH keys. To completely deactivate an account, the service and authentication policies should be checked as well.
Frequently Asked Questions
Even if nothing appears when entering the password, is it being entered?
Yes. For security reasons, it is common that the characters you type are not displayed and are replaced with asterisks. Press Enter after completing your input.
Official Documentation
You can check the exact behavior of the options and the differences in implementation in the official passwd documentation.









