Wednesday, January 22, 2025
HomeProgrammingHow to Change User Password in Linux | passwd Command

How to Change User Password in Linux | passwd Command

To change a user’s password in Linux, you can use the passwd command. Here’s a step-by-step guide on how to do it:

1. Change Your Own Password:

If you’re changing your own password, follow these steps:

  1. Open a terminal.
  2. Type the following command and press Enter:
    passwd
    
  3. You will be prompted to enter your current password.
  4. After entering your current password, you’ll be prompted to enter a new password.
  5. Enter the new password and press Enter.
  6. You will be asked to retype the new password for confirmation.
  7. If the new password meets the system’s requirements (e.g., length, complexity), it will be updated.
See also  What is the difference between a string and a byte string?

2. Change Another User’s Password (as a Root or Sudo User):

If you’re an administrator and need to change another user’s password, use the following steps:

  1. Open a terminal.
  2. Type the following command, replacing username with the target user’s username:
    sudo passwd username
    
  3. You will be prompted to enter your own password (if using sudo).
  4. After that, you’ll be asked to enter the new password for the specified user.
  5. Enter the new password and press Enter.
  6. You will be asked to retype the new password for confirmation.
  7. If the password meets the system requirements, it will be updated.
See also  How to Enable Line Numbers in Visual Studio

3. Tips:

  • Ensure the new password is strong, typically containing a mix of uppercase letters, lowercase letters, numbers, and special characters.
  • If you see a “password strength” prompt, it means your system has password complexity policies in place.
See also  How many zeros are in a googolplex?

That’s it! The passwd command is a simple and effective way to change passwords in Linux.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x