January 2018
Intermediate to advanced
376 pages
8h 45m
English
Let's say that Katelyn has gone on maternity leave and will be gone for at least several weeks. We can lock her account with:
sudo usermod -L katelyn
When you look at Katelyn's entry in the /etc/shadow file, you'll now see an exclamation point in front of her password hash, as follows:
katelyn:!$6$uA5ecH1A$MZ6q5U.cyY2SRSJezV000AudP.ckXXndBNsXUdMI1vPO8aFmlLXcbGV25K5HSSaCv4RlDilwzlXq/hKvXRkpB/:17446:0:99999:7:::
This exclamation point prevents the system from being able to read her password, which effectively locks her out of the system.
To unlock her account, just follow this:
sudo usermod -U katelyn
You'll see that the exclamation point has been removed so that she can now log in to her account.