passwd command in Linux with Examples

passwd command is a tool on Linux operating systems used to change a user’s password.

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.

passwd command in Linux with Examples

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.


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!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.