The passwd command is the fastest way to change your password
Open a terminal and type passwd, then press Enter. Linux will ask you to enter your current password, then prompt you twice for your new password. Type carefully — the characters you enter will not appear on screen. Once you confirm the new password the second time, the change takes effect when ready.
This works on any Linux distribution: Ubuntu, Fedora, Debian, Red Hat, or others. You do not need administrator rights to change your own password. If you are logged in as the user whose password you want to change, the passwd command will update that account.
The entire process takes about 30 seconds. You will see confirmation that the password has been updated successfully.
Key Takeaways
- Type passwd in a terminal, enter your current password, then type your new password twice to change it when ready.
- Characters you type will not display on screen, so type slowly and carefully to avoid mistakes.
- You can change only your own password unless you have root or sudo access, which lets you change any user's password.
- A strong password should be at least 12 characters long and mix uppercase, lowercase, numbers, and symbols.
- If you forget your password, you will need to boot into recovery mode or use another administrator account to reset it.
What happens if you type the password wrong
If you enter your current password incorrectly, Linux will reject the change and show "Authentication failure". You can try again when ready — there is no waiting period on the first attempt. Type your current password more carefully the second time.
If you enter your new password differently the two times you are asked to confirm it, Linux will reject the change and tell you the passwords do not match. Start over and type the new password exactly the same way both times. This is why typing slowly matters.
Changing another user's password with sudo
If you have sudo access (which most Ubuntu desktop users do), you can change another user's password. Type sudo passwd username, replacing "username" with the actual account name. Linux will ask for your own password, not the target user's password. Once you provide it, you can set a new password for that account without knowing the old one.
This is useful if someone forgets their password and you are the system administrator. The user can then log in with the new password you set. Be aware that changing someone else's password logs them out of any active sessions.
Making sure your new password is strong
Linux will warn you if your new password is too short or too straightforward, but it will usually let you set it anyway. A password that is only 6 characters long or uses only lowercase letters is weak and can be guessed. Aim for at least 12 characters that mix uppercase and lowercase letters, numbers, and symbols like ! or @.
Avoid passwords based on dictionary words, your username, or information someone could find out about you. "MyDog2024!" is weaker than "Tr0pic@lM00nlight9" because the first uses a common pattern. A random mix of characters is harder to crack, though harder to remember — consider using a password manager to store it.
What to do if you forget your password
If you forget your password and cannot log in, you will need to reset it from outside your account. On an Ubuntu desktop, restart the computer and hold Shift while it boots to enter GRUB (the boot menu). Select "Advanced options" and then "Recovery mode". This will give you a root prompt where you can type passwd username to reset the password for any account.
On a server or headless system, you may need physical access to the machine or access to a recovery console provided by your hosting provider. If you do not have either, contact your system administrator. This is why keeping a backup administrator account is important.
Changing your password on a remote server
If you are logged into a Linux server over SSH, the passwd command works exactly the same way. Open your SSH terminal and type passwd. The process is identical — enter your current password, then your new password twice. The change takes effect on the server when ready, and you will use the new password the next time you log in.
If you are locked out of a remote server, you will need to contact the server administrator or use a recovery method provided by your hosting company. Most providers offer a console or recovery mode you can access through their control panel without needing SSH access.
Password expiration and aging policies
Some systems are set up to force password changes at regular intervals — for example, every 90 days. If your password is about to expire, Linux will warn you when you log in. You can change it anytime using passwd; you do not have to wait until it expires. Changing it early does not reset the timer on most systems.
If your password has already expired, you will be forced to change it before you can use the account. Log in, and the system will when ready prompt you to set a new password. You cannot skip this step or use the account until you complete it.
Frequently Asked Questions
Why don't the characters show up when I type my password?
Linux hides password input for security. If characters appeared on screen, anyone looking over your shoulder could see your password. The system is recording what you type even though it is not displaying it. Type carefully and press Enter when done.
Can I change my password without knowing the old one?
No, unless you have sudo or root access. The passwd command requires you to enter your current password first as a security check. If you have forgotten it, you will need a system administrator to reset it, or you will need to boot into recovery mode on a local machine.
What if I set a password I cannot remember?
You will be locked out of that account. If you have another administrator account or sudo access, use it to reset the password. On a desktop, you can boot into recovery mode. On a server, contact your hosting provider or system administrator for help.
Does changing my password log me out of other sessions?
No. Changing your password does not automatically end other login sessions. However, the next time you try to use that account from another terminal or machine, you will need to use the new password. Existing sessions will continue to work until you log out.
Can I use special characters in my Linux password?
Yes. Linux passwords can include spaces, punctuation, and symbols. Special characters actually make passwords stronger. Just be aware that some symbols have meaning in the shell, so type carefully and consider using a password manager to store complex passwords.