Change an Account Password
Change an Account Password
The school assistant needs to change their password. passwd manages password credentials under the system's authentication policy. For your own account the usual request differs from an administrator selecting another account, so be clear about whose credential you intend to change.
A password is one way to authenticate, not the entire account. SSH keys, service credentials and already-running sessions can have separate lifetimes. We will use a practice account and distinguish a password update from a complete access-revocation plan.
What you’ll learn
- Change a user’s password and read the command’s result.
- Keep password authentication separate from SSH keys and existing sessions.
Changing a password does not remove every way in
Password store
passwd changes the password credential under local policy.
new passwordSeparate keys
Authorized SSH keys are configured elsewhere.
keys unchangedExisting sessions
Already-running sessions are not automatically erased by a password change.
sessions may remain
Change the practice account’s password
Prepare the example
Use the practice VM and the existing assistant account. The shown command is the authorized administrative form for that target. Password entry is interactive and normally does not echo characters; do not paste an actual password into course notes, source code or a command transcript.
Bash · Linux terminal
sudo passwd school-assistantExpected behavior; machine-dependent details
Interactive password prompts; never publish the actual password.sudo passwd school-assistant selects that account's password credential. Follow the prompts to enter and confirm the new value. A lack of visible characters while entering it is expected; it does not mean the terminal failed to receive your typing. Policy can reject a value or require additional checks.
Read the final diagnostic before assuming success. The updated password affects authentication paths that use that credential. It does not automatically remove authorized SSH keys or stop every existing session. If the goal is to revoke access rather than simply update a password, inspect those other mechanisms separately.
Own-password changes and administrative changes
The passwd command updates account passwords. Ordinary users can normally change their own password, while administrators can reset passwords for other accounts.
What is passwd?
passwd is a built-in Linux command used to change user passwords. You can use it to update your own password or change the password of another user (if you have sudo privileges).
Scenario 1: Change Your Own Password
If you're logged into your account and want to change your password, just run:
passwd
It will prompt you like this:
Current password:
New password:
Retype new password:
Once you successfully enter and confirm the new password, it will be updated.
Scenario 2: Change Another User's Password (As Admin)
Let’s say you're the admin and you want to change the password for a user named john. Here's what you do:
sudo passwd john
You’ll see a prompt like this:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Make sure you use a strong password and confirm it correctly.
Expire a Password to Force a Change
You can also expire a user's password so that they're forced to change it on next login:
sudo passwd --expire john
This is useful for setting temporary passwords or onboarding new users.
Common Issues
- If you get a “Permission denied” error, make sure you’re using
sudo. - If password rules are strict, you may need to use a longer or more complex password.
Set passwords and force changes when required
Here’s a quick summary:
passwd— change your own passwordsudo passwd <username>— change someone else’s passwordsudo passwd --expire <username>— force a user to change password at next login
And that’s it! You’ve learned how to use the passwd command like a Linux pro.
Try it out and see how easy it is to manage user passwords securely!
Try it, then check the worked answer
Your task: Does a password change automatically delete authorized SSH keys?
Use the practice VM and the existing assistant account. The shown command is the authorized administrative form for that target. Password entry is interactive and normally does not echo characters; do not paste an actual password into course notes, source code or a command transcript.
Bash · complete example for this question
sudo passwd school-assistantExpected behavior; machine-dependent details
Interactive password prompts; never publish the actual password.Worked answer
No; those authentication credentials are separate.
Changing the password does not automatically delete authorized SSH keys. They are separate credentials with separate configuration. A password update can be successful while another permitted authentication method still works.
Check your decision
A password is one authentication credential
Select the intended account, follow the interactive prompts and inspect the result. Keep authentication methods separate in your reasoning. Use a password update for its specific purpose rather than assume it is an account deletion, key removal or session termination operation.
Reaching the recap and completing the quizzes are separate milestones.