How to Change User Password in Ubuntu

The Cryptographic Hash Overwrite Vector

In the Ubuntu architecture, your user password is not stored as plain text. When you initialize an account, the Linux kernel mathematical salts and hashes your alphanumeric string using a complex SHA-512 algorithm, storing the resulting cryptographic cipher deep within the highly protected `/etc/shadow` registry. If your authentication token has been compromised, or if a corporate security protocol mandates a 90-day rotation, you cannot simply edit a text file. You must instruct the core OS architecture to accept a new string, execute the hashing algorithm, and overwrite the existing cipher in the shadow file.

How to Change User Password in Ubuntu

The Ubuntu kernel utilizes a dedicated, highly privileged C binary called `passwd` to handle all cryptographic string manipulations, ensuring the operation is executed securely within the terminal environment.

1. Open your terminal application or connect to the server via SSH.
2. Method 1: The Localized User Overwrite (Changing Your Own Password):
* If you are currently logged in as the specific user whose password needs changing, you do not require root privileges.
* Type exactly:
passwd
* Press Enter.
* The Execution Sequence:
* The kernel will first demand your current authentication token: `Changing password for [username]. (current) UNIX password:`. Type your old password and press Enter.
* The kernel will prompt: `New password:`. Inject your new alphanumeric string.
* The kernel will prompt: `Retype new password:`. Inject the exact string again to mathematically verify there are no typographical errors.
* Note: When typing passwords in a Linux terminal, no asterisks (*) or characters will appear on the screen. This is a deliberate security obfuscation.
* If successful, the terminal will output: `passwd: password updated successfully`.
3. Method 2: The Root Administrator Override (Changing Another User’s Password):
* If you are the system administrator (root) and need to forcibly reset a forgotten password for a subordinate user (e.g., `joshua`), you must invoke the `sudo` protocol.
* The Syntax: `sudo passwd [target_username]`
* Type exactly:
sudo passwd joshua
* Press Enter and supply your own root password to authorize the elevation.
* Because you are operating as root, the kernel will not ask for the user’s current password. It will immediately prompt: `New password:`.
* Inject the new string, verify it, and the kernel will instantly overwrite the cipher in `/etc/shadow`, effectively locking the user out of their old token.

Get the best tech tips delivered straight to your inbox.

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