Changing your password on Linux is an easy process. Whether you want to update your password for security reasons or just forgot it, here’s how you can change it.
1. Open Your Terminal
First, you need to open your Terminal. This is where you’ll run commands to interact with your system. You can open it by searching for “Terminal” in your app menu or by pressing Ctrl + Alt + T
on your keyboard.
2. Change Your Own Password
To change your own password, use the passwd
command. Just type:
passwd
After you press Enter, the system will prompt you for the following:
- Current password: Enter your current password (it won’t show on the screen as you type).
- New password: Enter your new password.
- Retype new password: Confirm your new password by typing it again.
Once you’ve entered your new password, you should see a message saying the password has been updated successfully.
3. Change Another User’s Password (as a Superuser)
If you are a superuser (root) or have sudo
privileges, you can change another user’s password. Use the following command:
sudo passwd username
Replace username
with the actual username of the account whose password you want to change.
For example, to change the password for a user called john
, type:
sudo passwd john
You’ll be prompted to enter your sudo password first, and then you’ll be asked to enter and confirm the new password for the user.
4. Password Tips
- Make sure your new password is strong, ideally with a mix of uppercase and lowercase letters, numbers, and special characters.
- Avoid using easy-to-guess passwords like “password123” or “12345.”