The fastest way to change your Ubuntu password
Open a terminal window and type passwd, then press Enter. Ubuntu will ask you to type your current password once, then your new password twice. That is the entire process — no restart needed, no settings menu to navigate.
The reason this works is that passwd is a command built into Ubuntu specifically for password changes. It runs with your own permissions, so you cannot accidentally change someone else's password, and it forces you to prove you know the old one before accepting a new one.
If you are sitting at the login screen and have forgotten your password entirely, you will need a different approach — see the section on recovering a forgotten password below.
Key Takeaways
- Type passwd in a terminal and press Enter to change your own password in under a minute.
- Ubuntu will ask for your current password first, then prompt you to type the new password twice to catch typos.
- A strong password should be at least 12 characters and mix uppercase, lowercase, numbers, and symbols.
- If you forget your password and cannot log in, you will need to restart into recovery mode or use another administrator account.
- The passwd command works the same way on all Ubuntu versions and most other Linux distributions.
Opening a terminal and running the passwd command
If you are already logged into Ubuntu, press Ctrl+Alt+T to open a terminal window. You should see a black or dark window with a blinking cursor and a line that ends with a dollar sign ($) or hash mark (#).
Type the word passwd (all lowercase) and press Enter. The terminal will respond with "Current password:" — this is asking for the password you use right now to log into Ubuntu. Type it and press Enter. Nothing will appear on screen as you type; this is normal and a security feature to prevent someone looking over your shoulder from seeing the length of your password.
Next, the terminal asks "New password:" — type your new password and press Enter. Again, nothing will appear. Then it asks "Retype new password:" — type the same new password a second time and press Enter. If the two match, the terminal will say "passwd: password updated successfully" and return you to the command prompt. If they do not match, it will say "They don't match, try again" and let you start over.
Choosing a password that Ubuntu will accept
Ubuntu does not force you to use a complex password, but it will warn you if your choice is weak. A warning is not a block — you can ignore it and use a straightforward password if you want — but the warning exists because weak passwords are the most common way someone gains unauthorized access to a computer.
A strong password is at least 12 characters long and includes uppercase letters, lowercase letters, numbers, and symbols. For example, "BlueMoon#2024!Tree" is stronger than "password123" because it mixes character types and is longer. Avoid using words from a dictionary, your username, or information someone could guess (like a birthday or pet name).
If you type a password that is too short or uses only one type of character, Ubuntu will print a message like "BAD PASSWORD: The password is too similar to the old one" or "BAD PASSWORD: The password contains the user name in some form". You can still press Enter to use it anyway, or you can backspace and choose a different one.
What to do if you forget your password and cannot log in
If you are at the Ubuntu login screen and cannot remember your password, you have two main options: restart into recovery mode, or use another administrator account on the same computer.
To use recovery mode, restart your computer. As it boots, hold down the Shift key until you see a menu with options like "Ubuntu", "Advanced options for Ubuntu", and "UEFI Firmware Settings". Click or press the arrow key to highlight "Advanced options for Ubuntu" and press Enter. You will see a list of kernel versions with "(recovery mode)" next to some of them. Select any recovery mode option and press Enter.
The computer will boot into a text screen with a menu. Look for an option that says "root" or "Drop to root shell prompt" and select it. You will be at a command prompt with a hash mark (#) at the end. Type passwd username, replacing "username" with the account name you forgot the password for. Press Enter, and Ubuntu will ask you to type a new password twice without asking for the old one. After you set it, type exit and press Enter, then select "resume" from the menu to boot back into Ubuntu normally.
If another person with an administrator account is logged into the same computer, they can open a terminal and type sudo passwd username, replacing "username" with your account name. They will need to type their own password, then set a new password for your account. This is faster than recovery mode if you have someone nearby who can help.
Changing the password for another user account
If you are an administrator and need to change someone else's password, open a terminal and type sudo passwd username, replacing "username" with the account you want to change. Press Enter. Ubuntu will ask for your own password (to confirm you are an administrator), then ask you to type the new password twice. You do not need to know the old password.
The person who owns that account will not be able to log in with their old password after this change. Tell them the new password in person or through a find channel — never type it into an email or message.
Changing your password on a schedule
Some workplaces or organizations require password changes every 30, 60, or 90 days. Ubuntu does not enforce this on its own — it is set up by a system administrator using a tool called chage (change age). If your account has been set to require regular password changes, Ubuntu will warn you when you log in that your password will expire on a certain date.
When that date arrives, you will not be able to log in until you change your password. Open a terminal (or use recovery mode if you cannot log in), run the passwd command as described above, and set a new password. The expiration timer resets.
If you want to know when your password will expire, open a terminal and type chage -l (that is the letter L, not the number 1). Press Enter. Ubuntu will show you the expiration date, if one is set. If it says "Password expires: never", then your password does not have an expiration date.
Troubleshooting common password change problems
If you type passwd and the terminal says "command not found", you are probably not in a standard Ubuntu environment. This can happen in some containers or minimal installations. Try /usr/bin/passwd instead — this is the full path to the command and usually works everywhere.
If you type your current password and the terminal says "Authentication failure", you typed it incorrectly. Press Ctrl+C to cancel and try again. Remember that passwords are case-sensitive — "Password" is not the same as "password".
If you are changing the password for another user and the terminal says "Permission denied", you are not logged in as an administrator. Ask someone with administrator access to change the password for you, or log out and log back in as an administrator account.
If the terminal says "passwd: user does not exist", you typed the username wrong. Check the spelling and try again. You can see a list of all user accounts on the computer by typing cut -d: -f1 /etc/passwd and pressing Enter.
Frequently Asked Questions
Do I need to restart Ubuntu after changing my password?
No. Your new password takes effect when ready. You will use it the next time you log in, but you do not need to restart the computer or close any open programs.
What happens if I type the new password wrong the second time?
Ubuntu will tell you the passwords do not match and ask you to start over. You will type the new password twice again. There is no limit to how many times you can try.
Can I change my password without opening a terminal?
Yes. Click the system menu (usually in the top right corner), select "Settings", then look for "Users" or "About". Click your account name and look for a "Change Password" button. This opens a graphical window instead of a terminal, but it does the same thing.
What if I change my password and then forget the new one when ready?
You will need to use recovery mode or ask another administrator to reset it, just as if you had forgotten any other password. There is no way to recover a password you just set — Ubuntu does not store passwords in a way that lets anyone read them back.
Does changing my password affect my files or programs?
No. Your files stay where they are, your programs keep working, and nothing else changes. Only the password itself is updated.