The fastest way to change root password

If you are logged in as root, open a terminal and type passwd, then press Enter. You will be prompted to enter your current password, then your new password twice. Linux will not show the characters as you type — this is normal. Once you confirm, the change takes effect when ready.

If you are logged in as a regular user and need to change the root password, you must use sudo passwd root instead. This runs the password command with root privileges. You will enter your own user password first (to prove you have sudo permission), then set the new root password the same way.

The root password is now changed. Any user with sudo access can change it this way, but only the root user or someone with sudo permission can do so — a regular user cannot change root's password without that permission.

Key Takeaways

  • From a root terminal, type passwd and follow the prompts to change the root password when ready.
  • From a regular user account, type sudo passwd root if you have sudo permission, then enter your own password first.
  • Linux will not display characters as you type the password — this is a security feature, not an error.
  • The password change takes effect right away; you do not need to restart or log out.
  • If you forget the root password and have no sudo users, you will need to boot into single-user mode or use a live USB to reset it.

Why you might need to change root password

You change the root password when you first set up a Linux system, when you suspect someone else knows it, or when you are handing over a server to another administrator. Some organizations require password changes on a schedule — your IT policy may dictate this.

If you are the only user on your machine and you use sudo instead of logging in as root directly, you may rarely need to change the root password. However, keeping it current is still a security practice, especially on shared systems or servers that face the internet.

Changing root password from a regular user account

Open a terminal and type sudo passwd root. Press Enter. The system will ask for your password — this is your own user password, not the root password. Type it and press Enter.

Now you will see the prompt "New password:" — this is where you enter the new root password. Type it carefully. You will not see the characters appear. Press Enter, then type the new password again when prompted to confirm. If the two entries match, the password is changed.

If you see the message "sudo: passwd: command not found" or "user is not in the sudoers file", you do not have permission to change the root password. Only users listed in the sudoers file can run commands with sudo. Contact your system administrator.

Changing root password when logged in as root

If you are already logged in as the root user, the process is simpler. Type passwd at the terminal prompt and press Enter. You will see "Current password:" — enter the current root password.

Then you will see "New password:" twice. Enter your new password both times. The system will confirm the change with a message like "password updated successfully". You are now done.

Some systems show slightly different wording, but the flow is always the same: current password, new password, confirm new password. If you make a typo in the confirmation, the system will reject it and ask you to start over.

What to do if you forget the root password

If you forget the root password and you have no other user account with sudo access, you will need to reset it using single-user mode or a live USB. Single-user mode boots the system with minimal services and often does not require a password to reach a root shell.

To enter single-user mode, restart your computer and hold down Shift during boot (on most distributions). You will see a menu — select "recovery mode" or the option that mentions single-user. Once you reach the root prompt, type passwd and set a new password.

If single-user mode is not available, you can use a live USB — a bootable Linux image on a USB drive. Boot from it, mount your system's hard drive, and use chroot to change into your system's root directory, then run passwd root from there. This requires more technical knowledge but works on any distribution.

Password requirements and best practices

Linux does not enforce password length or complexity by default — you can set a password as straightforward as "123" if you choose. However, this is a serious security risk, especially for the root account. A strong root password should be at least 12 characters long and include uppercase letters, lowercase letters, numbers, and symbols.

Avoid passwords based on dictionary words, your username, or information others might know about you. The root password grants complete control of the system, so treat it as your most sensitive credential. Write it down and store it securely if you must, but do not email it or share it over chat.

If you manage multiple systems, use a password manager to store root passwords securely rather than reusing the same password across machines. This way, if one system is compromised, the others remain protected.

Using sudo instead of logging in as root

Many Linux users and administrators prefer to use sudo for administrative tasks rather than logging in as root directly. This approach is safer because it logs which user ran which command, and you can grant specific sudo permissions to specific users without giving them the full root password.

If you follow this practice, you will rarely need to log in as root. You can still change the root password with sudo passwd root for security purposes, but your day-to-day work happens as a regular user. This reduces the risk of accidental damage from a mistyped command.

Frequently Asked Questions

Why does Linux not show my password as I type?

This is a security feature. If someone is watching your screen, they cannot see how many characters your password is or what they are. The password is being entered correctly even though you see nothing — just type carefully and press Enter when done.

Can I change the root password without knowing the current one?

Only if you have sudo access. With sudo passwd root, you prove your permission by entering your own password, and you can set a new root password without knowing the old one. If you have no sudo access and no other root-level account, you must use single-user mode or a live USB.

What happens if I make a typo when confirming the new password?

The system will reject the change and tell you the passwords do not match. You will start over from the "New password:" prompt. This is a safety feature to catch mistakes before they lock you out.

Do I need to restart Linux after changing the root password?

No. The password change takes effect when ready. You do not need to restart, log out, or run any additional commands. The next time you log in as root or use sudo, use the new password.

Can a regular user change another user's password?

No, unless they have sudo access. A regular user can only change their own password with the passwd command. Changing another user's password requires root or sudo permission.