The passwd command is used to change a user password in a Linux system through SSH. It updates the authentication credentials for the current user or another system user (depending on permissions).
It is commonly used for improving account security or resetting access credentials on a server.
Table of Contents
How the command works
The basic structure is:
passwd
When executed without additional parameters, the command changes the password of the currently logged-in user.
Changing a password
After running the command, the system will prompt for input:
- Enter the current password
- Enter the new password
- Confirm the new password
If all inputs match and meet system requirements, the password is updated immediately.
Changing another user’s password
If you have sufficient privileges (for example, root access), you can change another user’s password:
passwd username
Replace username with the target account name.
Password requirements
Depending on system configuration, the new password may need to meet certain rules such as:
- minimum length requirements
- complexity rules (letters, numbers, symbols)
- avoidance of common or previously used passwords
Practical use cases
The passwd command is commonly used for:
- resetting lost or compromised passwords
- updating credentials for security reasons
- managing multiple system users on a server
- enforcing access control policies
Practical implications
Password changes take effect immediately. The next login attempt must use the new password.
If SSH key authentication is enabled, password changes do not affect key-based access.
Incorrect password changes or forgotten credentials may temporarily block access to the account until reset through the hosting panel or support tools.
Summary
The passwd command allows users to change their system password directly from SSH. It is a core security tool used for managing access to a Linux environment.