Sale % Sale Holiday sale Sale Sale % Sale Sale Holiday sale Sale Sale % Sale Sale Holiday sale

How to change a Linux password?

Lukas Grigas
Cybersecurity Content Writer
how to change password in linux

Changing a user password on Linux is a relatively simple process — if you know what you're doing. Due to the complex interface, it can be a confusing experience for beginners. Today, we'll look at how to change passwords in Linux as well as how to change another user's password and force a password reset.

What is Linux?

Linux is a family of free, open-source operating systems that can be edited and adapted by its users. Systems like macOS and Windows limit user adaptability and their code cannot be easily modified. That prevents you from accidentally damaging the system, but it also takes power away from users. Linux offers an alternative.

In essence, Linux itself is a “kernel” — the software base around which the rest of an operating system, or distribution, is built. For that reason, you'll find different operating systems that all run on the Linux kernel. However, the instructions further down will apply for any Linux operating system.

How to change your password in Linux

To change the password for the currently logged in user, you can simply use the passwd command. The process is quick and simple. Here're the step by step instructions:

  1. Open the Terminal window.

  2. Type passwd and tap Enter.

  3. Now you will be prompted to enter your new password and confirm it by retyping it once more.

  4. Please note that your new password will not appear on the Terminal window. This is a security measure that prevents someone from looking over and simply seeing your password. So be extra careful when typing out the password.

  5. Once the change is successful you will see “Password updated successfully” in the terminal windows.

  • Make sure to create a strong password. A strong password should comprise at least 12 characters and include a mix of upper and lower-case letters, numbers, and special characters.

  • Make sure to have a unique password for your Linux device. Reusing passwords for multiple accounts makes it possible for bad actors to hack into an account to have access to others associated with that same user.

  • Use a password generator to create your new password. A password generator is designed to come up with strong, complex, and long passwords on demand.

How to change another user's password in Linux

To change a password for another user in Linux, you need to be logged in as a root user. Here's how you can do it:

  • Open the Terminal window.

  • Type the su - or sudo -i command and tap Enter.

  • Now as a root user, type the passwd command followed by a username for which you wish to prompt a password change: passwd username

  • Now enter the new password for the user and confirm it by retyping to it once more.

  • Tap Enter and you're all done!

How to force password reset in Linux

In some instances you might want to force a password reset procedure for a specific user: either for reusing the password across multiple accounts or because you know that the user's password was exposed in a breach. Whatever the reason might be, you can force a password reset in Linux with the help of a passwd command. Here're step-by-step instructions of how to do it:

  • Open the Terminal window.

  • Type the su - or sudo -i command and tap Enter.

  • Now as a root user, type the passwd command followed by a username for which you wish to prompt a password reset procedure: passwd -e username

  • That's it. The next time the user for whom the reset procedure has been prompted will be asked to reset their password.

Password security

Whatever operating system you use, password security is essential. Hackers and criminals know that a weak password can give them access to money, private data, and sensitive files. That's why users on any system or device should ensure that they're using strong, hard-to-crack login details.

NordPass, which is available for Linux operating systems, can generate complex, randomized passwords for every account and store them in an encrypted online vault. The service will autofill login, credit card, and personal information forms, ensuring that you never have to worry about forgetting your password again. On top of that, NordPass syncs your vault across an unlimited number of devices and platforms, which means that you'll have quick and secure access to your passwords and other digital valuables at any time, anywhere. Even when you're offline.

Switching to Linux can give users more power and security. Go the rest of the way with NordPass.

Subscribe to NordPass news

Get the latest news and tips from NordPass straight to your inbox.