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.
passwd [options] [LOGIN]
In man page, the describe it
- passwd – change user password
- man passwd
passwd command in Linux with Examples
To change another user’s password (as root):
sudo passwd <username>
<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:
--lock: Locks the specified user account.
--unlock: Unlocks the specified user account.
--status: Shows the password status of the specified user account.
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!