The passwd
command in Linux is used to change a user’s password. It allows users to set or modify their own passwords or, if executed with root privileges, change the password for any user on the system.
The syntax
passwd [options] [LOGIN]
In man page, the describe it
- passwd – change user password
- man passwd
passwd command in Linux with Examples
passwd huupv
To change another user’s password (as root):
sudo passwd <username>
Replace <username>
with the username of the user whose password you want to change. Running the command with sudo
and providing the username will prompt you to enter the new password for that user. Again, the characters won’t be displayed while typing.
It’s important to keep in mind that only the root user or users with appropriate privileges (e.g., members of the sudo group) can change other users’ passwords.
Additional options can be used with the passwd
command to modify its behavior, such as:
-l
or--lock
: Locks the specified user account.-u
or--unlock
: Unlocks the specified user account.-S
or--status
: Shows the password status of the specified user account.
Conclusion
The passwd command is a simple command in Linux. It is the most popular in-use terminal Linux for changing passwords users. You can refer to the passwd
command manual (man passwd
) for more detailed information on its usage and available options. Thank you for reading the DevopsRoles page!