How to Change Password in Ubuntu

The Cryptographic Regeneration Vector

When operating a secure Ubuntu server, the integrity of your primary user account is paramount. If you suspect your SSH keys have been compromised, or if corporate policy dictates a mandatory 90-day rotation, you must execute a low-level cryptographic protocol. You cannot rely on graphical interfaces on a headless server. You must instruct the Linux kernel to shred the existing password hash stored in the `/etc/shadow` file and inject a newly generated, highly secure cryptographic string.

How to Change Password in Ubuntu

The Linux environment utilizes the dedicated `passwd` utility, a core security binary that strictly enforces complexity rules and authenticates the user before authorizing the database rewrite.

1. Open your terminal application or connect to the server via SSH.
2. The Standard Execution Protocol (Changing Your Own Password):
* If you simply need to change the password for the account you are currently logged into, you do not need administrative privileges.
* Type exactly:
passwd
* Press Enter.
3. The Authentication Handshake:
* The kernel will first demand proof of identity. It will prompt you with: `(current) UNIX password:`
* Carefully type your existing password. Crucial Security Feature: Linux will not display asterisks or any characters on the screen as you type. This prevents visual shoulder-surfing. Just type it and press Enter.
4. The Cryptographic Injection:
* If the old password is correct, the system will prompt: `New password:`
* Type your new, highly secure cryptographic string (minimum 8 characters, combining uppercase, lowercase, numbers, and symbols). Press Enter.
* It will prompt you again: `Retype new password:` to ensure no typos occurred.
* If they match, the terminal will output `passwd: password updated successfully`. The `/etc/shadow` file is rewritten.
5. The Administrative Override (Changing Another User’s Password):
* If you are the root administrator and need to force a reset for a compromised employee account (e.g., `user_john`), you must bypass the “current password” check entirely.
* You must invoke `sudo` and specify the target username.
* Type exactly:
sudo passwd user_john
* Press Enter. The kernel will skip the current password check and immediately ask you to input the new password twice.

Get the best tech tips delivered straight to your inbox.

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