When you are managing a Linux server, relying on an old, weak password is a catastrophic security vulnerability. If a malicious actor brute-forces your password, they instantly gain total access to your entire digital infrastructure. You cannot wait for the system administrator to manually force a reset; you must proactively alter your cryptographic credentials on a regular basis. To physically rewrite the encrypted hash stored deep inside the Linux kernel’s shadow file, you must use the passwd command.
How the passwd Command Works
The passwd command is a highly secure, interactive cryptographic engine. When you execute it, it does not simply overwrite a text file. It engages a complex mathematical hashing algorithm (usually SHA-512 or bcrypt) to completely scramble your new password into an illegible string of characters before permanently burning it into the heavily guarded /etc/shadow file.
To change your own personal password, simply type the command into your terminal and press Enter:
passwd
The system will instantly pause and demand that you authenticate your identity by typing your Current Password. If you pass this security check, it will ask you to type your New Password, and then ask you to retype it a second time to prevent catastrophic typos. (Note: For maximum security, Linux will never display asterisk characters (***) when you type; the screen will remain completely blank).
Changing Other Users’ Passwords (Root Access)
If an employee leaves the company or is locked out of their account, a standard user cannot reset their password. You must have root privileges (via the sudo command) to forcefully override another user’s cryptographic hash.
To aggressively reset the password for a user named j_smith, execute:
sudo passwd j_smith
Because you are executing the command with root authority, the Linux kernel completely bypasses the standard authentication protocol. It will not ask you for j_smith‘s current password; it will simply demand the new password and instantly lock it in.
Forcing Password Expiration
A critical component of enterprise security is forcing users to cycle their passwords every 90 days. You can use the passwd command to mathematically expire a user’s password instantly.
sudo passwd -e j_smith
The -e (expire) flag physically reaches into the /etc/shadow file and zeroes out the timestamp. The very next time j_smith attempts to log into the server, the kernel will instantly reject their connection and force them into an interactive prompt, demanding they invent a brand new, highly secure password before allowing them to access the shell.