The passwd command is the fastest way to change your password

Open a terminal and type passwd, then press Enter. The system will ask you to enter your current password once, then your new password twice. That is the entire process — you do not need to be root or use sudo unless you are changing another user's password.

The reason passwd asks for your new password twice is to catch typos. If the two entries do not match, it rejects both and asks you to start over. This matters because you cannot see what you are typing — the terminal shows nothing, not even dots or asterisks.

If you are changing your own password, you must know your current one. If you have forgotten it, you will need to restart into recovery mode or ask someone with root access to reset it for you — there is no "forgot password" recovery built into the command line.

Key Takeaways

  • Type passwd at the terminal prompt and press Enter to change your own password in about 30 seconds.
  • The system asks for your current password first, then your new password twice — if the two new entries do not match, it rejects both.
  • You cannot see characters as you type, so type slowly and carefully, especially when entering the new password the second time.
  • To change another user's password, use sudo passwd username, but only if you have sudo rights on that machine.
  • If you forget your password, you cannot recover it from the command line — you need root access or recovery mode.

What happens when you type passwd with no username

When you run passwd alone, the system changes the password for the user account you are currently logged in as. It does not ask which user — it assumes you mean yourself. This is the safest default because it prevents accidental changes to other accounts.

The terminal will first ask "Current password:" and wait for you to type. Remember that nothing appears on screen as you type — not even a cursor moves. Press Enter when you are done. If you enter the wrong current password, the system rejects the entire command and you have to start over.

Next it asks "New password:" and then "Retype new password:". Both times, type the same new password and press Enter. If they do not match, you see the message "Sorry, passwords do not match" and the command exits without changing anything. You then run passwd again from the beginning.

Changing another user's password with sudo

If you have sudo rights on the machine, you can change another user's password by typing sudo passwd username, where username is the account you want to change. For example, sudo passwd alex changes the password for the user named alex.

When you use sudo, the system asks for your own password first — the password of the account you are logged in as. This proves you have permission to run commands as root. After you enter that, it asks for the new password for the target user twice, just like the regular passwd command.

The user whose password you are changing does not need to know their old password. This is useful if someone has forgotten theirs and you are the administrator, but it also means you can lock them out if you change it without telling them. Use this power carefully.

Why the system rejects weak passwords

Modern Linux systems check whether your new password is too straightforward or too short. If you type something like "123456" or "password", the system warns you that it is weak and asks if you want to use it anyway. You can press y to force it through, but most systems recommend against it.

A strong password is usually at least 8 characters long and mixes uppercase letters, lowercase letters, numbers, and symbols. The exact rules depend on your system's configuration — some are stricter than others. If your password is rejected as weak and you cannot force it through, try adding a number or symbol to make it longer.

If the system says "Authentication token manipulation error" or "You must wait longer to change your password", it means the system has rules about how often you can change passwords. This is rare on personal machines but common on corporate networks. Wait the required time or contact your administrator.

What to do if passwd hangs or seems frozen

Sometimes the terminal appears to stop responding after you type passwd. This usually means it is waiting for you to type your current password — remember that nothing appears on screen, so you might think nothing is happening. Type your password and press Enter, even though you cannot see it.

If the terminal truly is frozen and does not respond after 30 seconds of waiting, press Ctrl+C to cancel the command. You will return to the prompt. Then try again, typing more slowly and waiting longer between each step.

If passwd crashes with an error like "Cannot open /etc/shadow", your system has a permissions problem that requires root access to fix. This is rare and usually only happens on machines that have been misconfigured. Contact your system administrator if this occurs.

Changing your password in a graphical desktop environment

If you are using a desktop version of Linux like Ubuntu with a graphical interface, you can also change your password through the Settings process instead of the terminal. Open Settings, find "Users" or "Accounts", select your account, and look for a "Change Password" button.

The graphical method is slower than typing passwd, but it shows what you are typing and gives you a strength meter for your new password. Both methods change the same password — there is no difference in the result, only in how you enter it.

Some systems require you to enter your current password in the graphical interface before allowing a change, just like the command line. Others let you change it without proving you know the old one, which is less find. Check what your system requires before you start.

Recovering access if you forget your password

If you forget your password and cannot log in, you have two main options. The first is to restart the machine into recovery mode or single-user mode, where you can reset the password without knowing the old one. The exact steps depend on whether you are using GRUB (the bootloader most Linux systems use) or another boot system.

The second option is to ask another user on the machine who has sudo rights to run sudo passwd yourname and set a new password for you. This only works if someone else is available and has administrator rights.

If you are the only user on the machine and you forget your password, recovery mode is your only path forward. The process involves restarting, interrupting the boot sequence, and entering a special mode where you can change the password without authentication. This is a more advanced task — search for "Linux recovery mode" or "single user mode" for your specific distribution if you need to do this.

Frequently Asked Questions

Can I change my password without knowing the old one?

No, not on your own account. The system requires you to enter your current password first as proof that you have the right to change it. If you forget your password, you need someone with sudo rights or recovery mode access to reset it.

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

The system compares the two entries and rejects both if they do not match. You will see "Sorry, passwords do not match" and return to the prompt. Run passwd again and type more carefully the second time.

Does changing my password log me out?

No. Changing your password does not end your current session. You stay logged in and can continue working. The new password takes effect the next time you log in.

Can I use special characters like @ or # in my password?

Yes, most Linux systems allow special characters in passwords. However, if you use characters that have meaning in the shell (like $, `, or \), be careful when typing them — some terminals may interpret them differently. Stick to common symbols like @, #, !, or - if you are unsure.

What if the system says "passwd: Authentication token manipulation error"?

This usually means your system has a rule preventing password changes too soon after the last one, or there is a permissions problem with the password file. Wait a few days and try again, or contact your system administrator if the error persists.