passwd
userLinux/Unix
The passwd command is one of the most frequently used commands in Linux/Unix-like operating systems. passwd Change user password
Quick Reference
Command Name:
passwd
Category:
user
Platform:
Linux/Unix
Basic Usage:
passwd [options] [arguments]
Common Use Cases
Syntax
passwd [options] [username]
Options
Option | Description |
---|---|
-a, --algorithm ALGORITHM |
Specify the encryption algorithm (DES, MD5, SHA256, SHA512) |
-d, --delete |
Delete a user's password (make it empty) |
-e, --expire |
Force password change on next login |
-h, --help |
Display help message and exit |
-i, --inactive DAYS |
Set password inactive after expiration (disable account) |
-k, --keep-tokens |
Keep non-expired authentication tokens |
-l, --lock |
Lock the password of the named account |
-n, --minimum DAYS |
Set minimum number of days before password change |
-q, --quiet |
Quiet mode |
-r, --repository REPOSITORY |
Change password in repository REPOSITORY |
-R, --root CHROOT_DIR |
Apply changes in the CHROOT_DIR directory |
-S, --status |
Report password status on the named account |
-u, --unlock |
Unlock the password of the named account |
-w, --warn DAYS |
Set number of days of warning before password expires |
-x, --maximum DAYS |
Set maximum number of days before password change |
Examples
How to Use These Examples
The examples below show common ways to use the passwd
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
passwd