Security is the fundamental cornerstone of the Linux operating system. Whether you are running a personal desktop or managing a fleet of enterprise servers, changing your user password regularly is a critical security practice.
Because Linux is inherently a multi-user environment designed for networking, you do not use graphical settings menus to change passwords. You use a single, dedicated command-line utility called passwd.
How to Change Your Own Password
If you are logged into your own user account and simply want to update your current password to something stronger, the process takes less than thirty seconds.
- Open your terminal.
- Type the following command and press Enter:
passwd
The terminal will instantly prompt you with Changing password for [your username]. It will then ask you to verify your identity before allowing the change.
- Type your Current Password and press Enter. (Crucial Note: When you type passwords in the Linux terminal, the cursor will not move, and no asterisks or dots will appear on the screen. It looks like your keyboard is broken. This is a deliberate security feature to prevent someone looking over your shoulder from guessing the length of your password. Just type normally and press Enter).
- The terminal will now prompt you for a New password. Type your new, strong password and press Enter.
- It will prompt you to Retype new password. Type it exactly the same way and press Enter.
If the two new passwords match, the terminal will print passwd: password updated successfully. The change is instantaneous. The next time you log in or run a sudo command, you must use the new password.
How to Change Another User’s Password (Root Access)
If you are a system administrator and an employee forgot their password, they cannot use the standard passwd command because they cannot log in. You must force the password change using your Administrator (Root) privileges.
You can change any user’s password on the system by appending their username to the command.
- Open your terminal.
- Type
sudo passwdfollowed by the specific username of the employee. For example:
sudo passwd john_smith
- Press Enter. Because you used
sudo, Linux will ask for your administrator password first to prove you have the authority to do this. Type your password and press Enter. - Linux will now instantly prompt you for the New password for John Smith. (Notice that it does not ask for John’s current password; as an administrator, you have the power to blindly overwrite it).
- Type the new password, press Enter, retype it, and press Enter again.
John Smith’s old password is now dead, and he must use the new one you just assigned to him.
Troubleshooting: “Bad Password” Warnings
Linux is designed to protect users from themselves. If you try to change your password to something incredibly weak (like “password123” or “qwerty”), the terminal will interrupt you and throw an error message saying BAD PASSWORD: The password is shorter than 8 characters or BAD PASSWORD: The password fails the dictionary check.
If you are a standard user, Linux will often completely reject the weak password and force you to start over.
However, if you are running the command as Root (using sudo), Linux assumes you know exactly what you are doing. It will print the “BAD PASSWORD” warning to scold you, but it will still allow you to bypass the security check and successfully set the weak password anyway. You should avoid doing this on any production server.