The passwd command is the standard way to change your own password
Open a terminal and type passwd, then press Enter. The system will ask you to enter your current password, then prompt you twice for your new password. If the passwords match and meet your system's requirements, the change takes effect when ready. You do not need to log out and back in — your new password works the next time you open a new terminal or session.
If you are changing your password on a remote server over SSH, the same command works. Type passwd, provide your old password, then your new password twice. The connection stays open while you change it.
Key Takeaways
- The passwd command changes your own password without needing administrator permission.
- You must know your current password to change it — the system asks for it first as a security check.
- Your new password takes effect when ready and applies to all future logins on that system.
- If you forget your password, you need administrator access or recovery methods set up beforehand, because you cannot change it without knowing the old one.
- Password requirements (length, special characters, expiration) depend on your system's configuration and may prevent weak passwords.
What happens if the system rejects your new password
Linux systems often enforce password rules. Common reasons for rejection include: the password is too short (often fewer than 8 characters), it is too similar to your username or previous passwords, or it does not contain a mix of uppercase, lowercase, numbers, or special characters. The error message usually tells you which rule failed.
If you see "Authentication token manipulation error," the system cannot write the password change to disk — this usually means a filesystem problem or permission issue, not a problem with the password itself. Contact your system administrator if this happens.
Changing another user's password if you have administrator access
If you have sudo permission or are logged in as root, you can change another user's password. Type sudo passwd username, replacing "username" with the actual account name. You will be asked for your own password (to confirm you have sudo permission), then you can set a new password for that user without knowing their old one.
The user does not need to be logged in. Their new password takes effect when ready, and they will use it the next time they log in. This is useful when a user forgets their password or when an administrator needs to reset an account.
Using passwd with options for specific situations
passwd -e username (as root or with sudo) forces a user to change their password on the next login. This is useful when you have just created a new account or suspect a password has been compromised. The user will be prompted to set a new password before they can use the account.
passwd -l username locks a user account, preventing login even if someone knows the password. The account can be unlocked later with passwd -u username. Locking is different from deleting — the account and its files remain intact.
passwd -d username removes the password entirely, allowing login without a password. This is rarely used on production systems because it creates a security gap, but it can be useful for testing or temporary access on isolated machines.
Password files and where the system stores them
Linux stores user account information in /etc/passwd and encrypted passwords in /etc/shadow. You do not edit these files directly to change a password — the passwd command handles the encryption and file locking automatically. Editing them by hand can corrupt the account or create security problems.
The /etc/shadow file is readable only by root, which is why regular users cannot see other users' password hashes. When you run passwd, the system verifies your identity by checking your current password against the hash in that file, then updates it with the new one.
What to do if you forget your password
If you forget your password and have no administrator access, you cannot change it through normal means — the system requires your old password as proof of identity. Your options depend on your setup: if you have physical access to the machine, you may be able to boot into single-user mode or use a recovery partition. If the machine is remote or managed by an organization, contact your system administrator.
This is why some systems ask you to set up a recovery email or phone number during account creation. If your account has one configured, you may be able to use it to reset your password, but this depends on how your system was set up.
Frequently Asked Questions
Do I need to restart or log out after changing my password?
No. Your new password takes effect when ready. Existing terminal sessions stay open, and you use the new password the next time you log in to a new session or connect to the system again.
Can I change my password if I am using a remote server?
Yes. Type passwd over SSH the same way you would on a local machine. The connection stays open while you change it, and the new password works on your next login.
What if I type my new password wrong twice and it does not match?
The system will reject the change and ask you to try again. Your old password remains in effect. There is no penalty for mistyping — just run passwd again and enter the passwords more carefully.
Can I see my password after I type it?
No. The terminal hides passwords as you type them for security — you will see nothing or dots, depending on your system. This prevents someone looking over your shoulder from seeing it.
What is the difference between passwd and sudo passwd?
passwd alone changes your own password and requires you to know the old one. sudo passwd username changes another user's password and requires administrator permission, but not the old password.