passwd Command

Change a user’s password

Price range: €18.18 through €24.12

Command:

bash
sudo passwd {username}

Explanation:

  • sudo: Runs the command with superuser privileges, which are required to change the password for another user.
  • passwd: The command used to change a user’s password.
  • {username}: The username of the account whose password you wish to change. Replace {username} with the actual username (e.g., johnalice).

Example:

To change the password for the user john, the command would be:

bash
sudo passwd john

Result:

After executing the command, you will be prompted to enter the new password for the specified user. The password will need to be confirmed by entering it again.


Additional Notes:

  • If you are changing your own password (the user you’re logged in as), you can simply use:
    bash
    passwd
  • Passwords in Linux are typically stored in an encrypted format for security.
  • Ensure the new password meets the system’s password policies (e.g., minimum length, complexity).
Select options This product has multiple variants. The options may be chosen on the product page