What is the purpose of lock commands in Linux?
To control account access by locking/unlocking accounts and enforcing password policies
Name commands used for account locking/unlocking.
passwd, usermod, chage
What does the passwd command do?
Manages user passwords and account locking/unlocking
Example to lock an account using passwd?
sudo passwd -l rterrance
Example to unlock an account using passwd?
sudo passwd -u rterrance
What happens when an account is locked?
Disables the user’s password, preventing login
Why is unlocking useful?
Restores password-based login
Why use locking instead of deleting?
For temporary access suspension without removing the account
What does the usermod command do?
Modifies user account details, including locking/unlocking
Example to lock an account using usermod?
sudo usermod -L rterrance
Example to unlock an account using usermod?
sudo usermod -U rterrance
What does -L option in usermod do?
Disables the password, blocking login
What does -U option in usermod do?
Re-enables login by unlocking the account
What does the chage command do?
Manages password expiration and aging policies
Syntax for chage?
chage [OPTIONS] [USERNAME]
Example to set password to expire every 30 days and warn 7 days before?
sudo chage -M 30 -W 7 rterrance
What does -M option in chage do?
Sets maximum password age
What does -W option in chage do?
Sets warning period before expiration
Command to view password aging info?
sudo chage -l rterrance
Example to set account expiration date?
sudo chage -E 2025-12-31 jdoe
What does -E option in chage do?
Disables account after the specified date
Why use chage?
Ensures passwords are updated regularly and accounts are not left active indefinitely