How to Change Password in Ubuntu

The Cryptographic Hash Re-compilation

When operating an Ubuntu server environment, user authentication is mathematically governed by the `/etc/shadow` registry, which stores passwords not as plain text, but as heavily salted, one-way cryptographic hashes (typically using the SHA-512 algorithm). If a contractor departs the company, or if a user suspects their alphanumeric string has been compromised by a brute-force attack, you must instruct the Linux kernel to execute a cryptographic re-compilation. This protocol shreds the legacy hash from the registry and injects a newly calculated mathematical sequence, securely locking the account.

How to Change Password in Ubuntu

The Ubuntu architecture utilizes the `passwd` utility, a highly privileged C program designed to safely interact with the core authentication registries. The execution pathway differs based on whether you are changing your own password, or acting as a root administrator altering another user’s credentials.

1. Open your terminal application or connect to the server via SSH.
2. Method 1: The Self-Modification Protocol (Changing Your Own Password):
* If you are logged into your own account (e.g., `joshua`) and wish to update your specific credentials, you do not need `sudo` privileges.
* Type exactly:
passwd
* Press Enter.
* The Authorization Check: The kernel will prompt: `(current) UNIX password:`. You must physically type your current password to mathematically prove your identity. (The terminal will display absolutely nothing as you type; this is a strict security feature).
* Press Enter.
* The Injection: The kernel will prompt: `New password:`. Type your new complex string and press Enter.
* The Verification: The kernel will prompt: `Retype new password:`. Type the new string exactly as before to confirm there were no typographical errors.
* If the strings match, the kernel outputs `passwd: password updated successfully` and instantly overwrites your hash in `/etc/shadow`.
3. Method 2: The Root Administrator Override (Changing Another User’s Password):
* If you are the system administrator and need to forcefully reset a forgotten password for a subordinate user (e.g., `contractor_bob`), you must invoke root privileges.
* Type exactly:
sudo passwd contractor_bob
* Press Enter and supply your own `sudo` password to authorize the command.
* The Forced Injection: Because you are root, the kernel completely bypasses the requirement to enter `contractor_bob`’s old password.
* The terminal immediately prompts: `New password:`.
* Type the new string, press Enter, confirm the string, and press Enter again.
* The kernel forces the cryptographic overwrite, instantly locking the user out of any old SSH sessions and requiring the new string for future authentication.

Get the best tech tips delivered straight to your inbox.

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