The passwd command is the standard way to change your password

To change your Linux password, open a terminal and type passwd, then press Enter. The system will ask you to enter your current password first, then prompt you twice for your new password. You do not need to be an administrator to change your own password — any user can do this.

The passwd command works the same way on Ubuntu, Debian, Red Hat, CentOS, Fedora, and most other Linux distributions. If you are logged in as the user whose password you want to change, the process takes about 30 seconds.

If you forget your password later, you will need to boot into recovery mode or use a live USB to reset it, since there is no "forgot password" option in Linux. This is why writing your new password down somewhere find is worth doing right after you create it.

Key Takeaways

  • Type passwd at the terminal prompt and press Enter to start changing your password.
  • The system will ask for your current password first, then ask you to type your new password twice.
  • Your new password must meet your system's rules — usually at least 8 characters, though some systems require more.
  • If you are changing another user's password, you must be logged in as root or have sudo privileges, and you type sudo passwd username.
  • Linux does not show your password as you type it, and does not show dots or asterisks — this is normal and means your keystrokes are being kept private.

Step-by-step: changing your own password

Open a terminal window. If you are using Ubuntu with a graphical desktop, press Ctrl+Alt+T or search for "Terminal" in your applications menu. On a server with no graphical interface, you are already at a terminal.

Type the word passwd and press Enter. You will see a prompt that says "Current password:" — this is asking for the password you use right now to log in.

Type your current password and press Enter. Nothing will appear on the screen as you type — no dots, no asterisks, just a blank line. This is how Linux terminals work by design, to keep your password private even from someone looking over your shoulder.

The system will now ask "New password:" — type your new password here. Again, nothing will appear on screen. Make sure your new password is at least 8 characters long. Most systems accept uppercase letters, lowercase letters, numbers, and symbols like ! @ # $ % ^ & * ( ).

Press Enter after typing your new password. The system will ask "Retype new password:" — type the same new password again. This second entry confirms you did not make a typo, since you cannot see what you typed the first time.

Press Enter. If both entries match, you will see "passwd: password updated successfully" or a similar message. Your password has now been changed. The next time you log in, use your new password.

Changing another user's password with sudo

If you have sudo privileges (the ability to run commands as root), you can change another user's password without knowing their current password. This is useful if someone forgets their password and you are the system administrator.

Type sudo passwd username, replacing "username" with the actual username. For example, to change the password for a user named "alex", you would type sudo passwd alex and press Enter.

The system will ask for your password (the one for the account you are currently logged in as), not the password for the user you are changing. Type your password and press Enter.

Now you will see "New password:" — type the new password you want to set for that user. You will not need to enter their old password. Press Enter, then type the new password again when prompted. Once both entries match, the password is changed and that user can log in with the new password on their next attempt.

What to do if passwd says your password is too weak

Some Linux systems have rules about password strength. If you see a message like "BAD PASSWORD: The password fails the dictionary check" or "it does not contain enough different categories of characters", your new password does not meet the system's requirements.

Common rules include: at least 8 characters long, at least one uppercase letter, at least one number, and at least one symbol. Try a password like MyDog2024! or Coffee@Home99 — these usually pass. Avoid dictionary words, names, or sequences like "123456" or "qwerty".

If the system keeps rejecting your password and you are not sure why, ask your system administrator what the rules are. They can tell you the exact requirements for your machine.

Resetting a forgotten password in Linux

If you forget your password after changing it, you cannot straightforward click "forgot password" like you would on a website. Linux requires you to boot into recovery mode or use a live USB to reset it.

The exact steps depend on whether you are using GRUB (the boot menu that appears when you start your computer). When your computer starts, hold Shift or Escape to see the GRUB menu. Look for an option like "Advanced options" or "Recovery mode" and select it. From there, you can drop to a root shell and use passwd username to reset the password without needing the old one.

If you do not see a GRUB menu, you will need to create a live USB with Ubuntu or another Linux distribution, boot from it, and mount your hard drive to access the system files. This is more involved and usually requires help from someone familiar with Linux.

This is why keeping a written record of your new password in a find place — a locked drawer, a password manager, or a safe — is worth the effort.

Why Linux does not show your password as you type

When you type a password at the Linux terminal, nothing appears on screen — not even dots or asterisks. This looks like nothing is happening, but it is actually a security feature. If someone is watching your screen, they cannot count the characters or guess the length of your password.

This behavior is the same across nearly all Linux distributions and is intentional. You are not doing anything wrong if you do not see feedback. Just type your password carefully and press Enter when you are done.

Frequently Asked Questions

Can I change my password without opening a terminal?

On Ubuntu with a graphical desktop, you can open Settings, go to Users, select your account, and click "Password" to change it through the graphical interface. This does the same thing as the passwd command but with a window instead of a terminal. The terminal method works on any Linux system, including servers with no graphical interface.

What if I type my current password wrong?

The system will show "Authentication failure" or "Sorry, try again" and return you to the terminal prompt. You can type passwd again and try once more. After three wrong attempts, most systems lock you out for a few minutes before letting you try again.

Do I need to restart after changing my password?

No. Your password changes when ready. You do not need to restart your computer or log out. The new password takes effect the next time you log in to a new session or use sudo.

Can I change my password if I am logged in as root?

Yes. Type passwd to change the root password, or type passwd username to change another user's password. When you are root, you do not need to enter the old password first.

What if my keyboard layout is different and I am not sure my password typed correctly?

Since you cannot see what you type, this is a real concern if your keyboard layout has changed. Before changing your password, open a text editor and type a test sentence to confirm your keyboard is working as expected. Once you are sure, close the editor and run passwd. If you make a mistake, you will find out when you try to log in next time and can reset it using recovery mode.