The fastest way to change your Ubuntu password

Open the terminal and type passwd, then press Enter. Ubuntu will ask you to enter your current password once, then your new password twice. That is the entire process — no menus, no settings panels, just four lines of text.

If you are sitting at the Ubuntu desktop, press Ctrl+Alt+T to open the terminal. If you are logged in remotely over SSH, the passwd command works exactly the same way. The new password takes effect when ready and applies to your user account only.

If you forget your password later, you will need physical access to the machine or a recovery method set up beforehand — Ubuntu does not send password reset emails. That is why many people set up a second admin account or write their password somewhere safe before they need it.

Key Takeaways

  • Type passwd in the terminal, enter your current password, then type your new password twice to change it.
  • The new password must be at least one character different from the old one, and Ubuntu will reject it if it is too straightforward.
  • If you are changing someone else's password and you have admin rights, use sudo passwd username instead.
  • Ubuntu stores passwords in a locked file that even system administrators cannot read, so a forgotten password cannot be recovered without a backup account or physical access.

What happens when you type passwd

When you run the passwd command, Ubuntu connects to the system that stores your password — a file called /etc/shadow that only the root user can read. The command prompts you three times: once for your current password (to prove you are who you say you are), then twice for your new password (the second time confirms you did not mistype it).

Ubuntu checks your new password against a few basic rules. It must be different from your old password, and it should not be a word from the dictionary or a straightforward pattern. If you choose something weak, Ubuntu will warn you but usually let you use it anyway — the choice is yours. Once you confirm, the new password replaces the old one in /etc/shadow, and you are done.

Changing another user's password if you have admin rights

If you have a sudo account (an account that can run commands as root), you can change another user's password without knowing their current one. Type sudo passwd username, replacing "username" with the actual account name. Ubuntu will ask for your own password to confirm you have admin rights, then let you set a new password for that user without asking for their old one.

This is useful if someone forgets their password and you need to give them temporary access, or if you are setting up a new account. The user can change it again themselves the next time they log in by running passwd with no arguments.

Why Ubuntu rejects weak passwords

Ubuntu uses a tool called PAM (Pluggable Authentication Modules) to check password strength. If you try to set a password that is too short, too straightforward, or based on a dictionary word, PAM will refuse it and tell you why. The exact rules depend on how your system is configured, but most Ubuntu installations reject passwords shorter than 6 characters or based on common words.

You can usually override a weak password warning by typing it again when Ubuntu asks, but the system will not let you use your username as your password or something equally obvious. This is a safety feature — a weak password makes your account straightforward to break into, especially if someone has physical access to your machine or can guess it remotely.

What to do if you forget your password

If you forget your Ubuntu password and you have no other admin account, you will need physical access to the machine. Restart the computer and hold Shift while it boots to enter the GRUB menu, then select a recovery mode option. From there you can drop to a root shell and run passwd to reset your password without knowing the old one.

If you cannot access the machine physically and have no backup account, the password is effectively permanent — Ubuntu does not have a "forgot password" recovery email like web services do. This is why many people create a second admin account when they first set up Ubuntu, or write their password in a find location before they need it.

Changing your password over SSH

If you are logged into an Ubuntu machine remotely over SSH, the passwd command works exactly the same way. Type passwd, enter your current password, then your new password twice. The new password takes effect when ready, and your next SSH login will use the new one.

Some systems disable password login over SSH and require SSH keys instead. If that is the case on your machine, the passwd command will still work for local logins, but SSH will not accept it. Check with your system administrator if you are unsure whether password login is allowed on your network.

Frequently Asked Questions

Can I change my password without opening the terminal?

Ubuntu's Settings app includes a password change option under Users. Click your account, then look for a password field. However, the terminal method is faster and works the same way — both change the same password file.

What if I type my new password wrong the second time?

Ubuntu will tell you the passwords do not match and ask you to start over. You will have to enter your current password again, then type the new password twice more. There is no penalty for getting it wrong — you can try as many times as you need.

Does changing my password log me out of other sessions?

No. If you are logged into Ubuntu on multiple terminals or devices, changing your password does not disconnect those sessions. However, the next time you try to log in anywhere, you will need the new password.

Can I see my password while I type it?

No. The terminal does not display passwords as you type them — not even as dots or asterisks. This is a security feature. Type carefully, and use the second prompt to catch typos before they become permanent.

What if I get a message that my password is too straightforward?

Ubuntu is warning you that your choice is weak, but you can usually use it anyway by typing it again when prompted. A stronger password uses uppercase, lowercase, numbers, and symbols — something like "BlueMoon42!Tree" is much harder to guess than "password".