Linux how to change password
To change a user’s password in Linux, you can use the
passwd command. Here’s how:
- Open the Terminal.
- Type the following command and press Enter:
- When prompted, enter the current password for the user.
- When prompted, enter the new password for the user. Note that Linux passwords are case-sensitive and must be at least 8 characters long and include a mix of uppercase and lowercase letters, numbers, and symbols.
- When prompted, re-enter the new password to confirm.
- Once the new password has been set, you will see a message indicating that the password has been changed successfully.
Note that if you are not logged in as the user whose password you want to change, you will need to use the
sudo command to run the
passwd command with administrative privileges. For example, to change the password for the user “john”, you would run the following command:
sudo passwd john
You will be prompted to enter your own password to authenticate with administrative privileges before being able to change the user’s password.