How to Change Your User Password in Ubuntu

The Security Rotation Vector

Maintaining strong security on an Ubuntu Linux server requires rotating user passwords frequently. If a user suspects their account has been compromised, or if an administrator is enforcing a mandatory 90-day security policy, the password must be changed immediately. Unlike graphical environments where you click through settings menus, password management in a headless Linux environment is executed entirely via the command-line interface, interacting directly with the system’s encrypted shadow file.

How to Change Your User Password

The standard tool for securely modifying authentication credentials in Linux is the passwd command.

1. Open your terminal application or connect to your server via SSH.
2. To change the password for the account you are currently logged into, simply type the command with no additional flags:

passwd

3. The system will first prompt you to enter your (current) UNIX password to verify your identity. Type it carefully (the characters will remain completely invisible on the screen) and press Enter.
4. The system will then ask you for your New password. Type it and press Enter.
5. Finally, it will ask you to Retype new password to confirm there were no typos. Press Enter again.
6. Administrative Override: If you are an administrator and need to forcefully reset the password of a different user (e.g., a user named johndoe who has forgotten their login), you must use the sudo command:

sudo passwd johndoe

The system will instantly update the cryptographic hash in the shadow file, and the new password will be required for all future login attempts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.