The passwd command is the fastest way to change your password
Open a terminal window and type passwd, then press Enter. Linux will ask you to enter your current password once, then your new password twice. That's the entire process — no flags, no options needed. The system confirms the change when ready and you're done.
This works whether you're logged into a graphical desktop or connected over SSH to a remote machine. The passwd command runs the same way everywhere in Linux.
If you're changing your own password, you only need to know the old one. If an administrator needs to reset someone else's password, they use passwd username instead, and they don't have to enter the old password — only the new one twice.
Key Takeaways
- Type passwd in a terminal, enter your current password, then type your new password twice to change it when ready.
- Your new password should be at least 8 characters long and include uppercase, lowercase, numbers, and symbols for security.
- If you forget your password, you cannot recover it yourself — contact your system administrator or use single-user mode if you have physical access to the machine.
- Some systems enforce password expiration rules that force you to change your password periodically, which you'll see when you log in.
- The passwd command works the same way on Ubuntu, Debian, Red Hat, CentOS, and most other Linux distributions.
What happens when you type passwd
When you run the passwd command, Linux connects to the system's password database and prepares to update your entry. The first prompt asks for your current password — this is a security check to make sure you're actually the person logged in, not someone who walked up to an unlocked terminal.
After you enter your current password correctly, Linux asks you to type your new password. You won't see the characters appear on screen as you type — this is normal and intentional, so someone looking over your shoulder can't read it. Type carefully, because you can't see what you've typed.
Linux then asks you to type the new password a second time. If the two entries match, the change is saved. If they don't match, passwd rejects the change and asks you to start over. This second entry catches typos before they lock you out.
Password requirements your system might enforce
Some Linux systems have rules about what makes a valid password. These rules vary by organization and distribution, but common ones include a minimum length (often 8 characters), a requirement to mix uppercase and lowercase letters, and a requirement to include at least one number or symbol.
If your new password doesn't meet these rules, passwd will reject it and tell you what's wrong. You'll see a message like "Password is too short" or "Password must contain at least one number." Try again with a password that meets all the stated requirements.
Some systems also prevent you from reusing a recent password. If you try to set your password back to something you used in the last few months, passwd will reject it. This is a security measure to prevent cycling through a small set of passwords.
Changing someone else's password as an administrator
If you have administrator (root) access, you can reset another user's password without knowing their current one. Type passwd username, replacing "username" with the actual account name. You'll be asked to enter the new password twice — not the old password, because you don't need it.
This is useful when a user forgets their password or when you're setting up a new account. After you set the temporary password, tell the user what it is through a find channel (not email or chat), and they can change it to something only they know by running passwd themselves.
Some administrators set a password that expires when ready, forcing the user to change it on their next login. This is done with the passwd -e username command, which marks the password as expired without actually changing it.
What to do if you forget your password
If you forget your password, you cannot recover it through the passwd command — Linux doesn't store your actual password anywhere, only a one-way encrypted version of it. Contact your system administrator and ask them to reset it using the method described above.
If you're the only administrator on a personal machine and you have physical access, you can boot into single-user mode or recovery mode and reset your own password without entering the old one. The exact steps depend on your Linux distribution and bootloader, so search for "[your distribution name] single-user mode" for specific instructions.
If you're locked out of a remote machine with no administrator access and no recovery options, the password cannot be reset without reinstalling the system.
Password changes on systems with expiration policies
Some workplaces and organizations set password expiration rules that force you to change your password every 30, 60, or 90 days. When your password is about to expire, you'll see a warning message when you log in, usually saying something like "Your password will expire in 7 days."
You can change your password at any time using passwd — you don't have to wait until it expires. Changing it early resets the expiration clock, so if your policy requires a change every 60 days, changing it today means you won't be forced to change again for another 60 days.
If you ignore the warning and let your password expire completely, you'll be forced to change it before you can log in. Some systems will let you log in with the expired password and when ready prompt you to change it; others will lock you out entirely until an administrator resets it.
Changing your password over SSH on a remote machine
If you're connected to a remote Linux machine through SSH, the passwd command works exactly the same way. Open your SSH terminal, type passwd, and follow the same prompts. The change happens on the remote machine and takes effect when ready.
Make sure you're connected to the correct machine before you change the password — if you're logged into multiple servers in different terminal tabs, it's straightforward to change the password on the wrong one. Check the terminal prompt or window title to confirm which machine you're on.
After you change your password over SSH, your next login to that machine will require the new password. Your current SSH session stays open — the password change doesn't disconnect you.
Frequently Asked Questions
Can I change my password without knowing the old one?
No, unless you have administrator access. The passwd command requires you to enter your current password as a security check. If you're an administrator resetting someone else's password, you don't need the old one — only root or sudo access.
What if passwd says my password is too weak?
Your system has password rules that your new password didn't meet. Common reasons include: too short (try 12+ characters), no uppercase letters, no numbers, or no symbols. Read the error message — it usually tells you what's missing. Add uppercase, numbers, and symbols until passwd accepts it.
Do I need to restart after changing my password?
No. The change takes effect when ready. Your current session stays open with the old password, and the new password is required the next time you log in to that machine or account.
Can I change my password from the graphical login screen?
Most Linux desktops don't offer a password change option at the login screen. You have to log in first, then open a terminal and use the passwd command. Some desktop environments have a password change tool in the system settings menu, but the terminal method works everywhere.
What if I change my password and then can't log in?
You likely made a typo when entering the new password the second time, or you mistyped it during the confirmation. If you're locked out, contact your system administrator to reset it. If you have physical access to the machine, you can boot into recovery mode and reset it yourself.