Situation
Interns are joining the server team. Their accounts are created with a temporary password, and after that everyone
changes it themselves with passwd. The intern intern set the password qwerty12 — the system did not object.
Guessing a password can go on forever too: wrong passwords in su have no consequences.
You are the administrator: you log in with a key (ssh localhost) and work through sudo. The intern's account is
handy for checking the result: su - intern, password qwerty12.
Task
- With
passwd, a user cannot set a password shorter than 12 characters or with fewer than three character classes (lowercase, uppercase, digits, others). A password that follows these rules is accepted. - The rules are written in
/etc/security/pwquality.conf(or in a file in/etc/security/pwquality.conf.d/) —pwscoresees them. - After three wrong passwords in a row the account is locked for any password login: the console,
su,sudo. A successful login before the lockout resets the counter. - Your own access is intact: student's key login,
sudoand the console login work as before.
A mistake in
/etc/pam.dcan close both logins andsudo. Edit PAM from a root shellsudo -iand do not leave it untilsu - student -c 'sudo -n true'finishes without an error. There is no internet on the machine; everything you need is already installed.
Lab goals
0 of 4-
pwscore rejects passwords shorter than 12 characters or with fewer than three classes and accepts a compliant one — not checked yet
-
passwd does not let a user set a weak password and accepts a compliant one — not checked yet
-
Three wrong passwords in a row lock the account for any password login, and a successful login resets the counter — not checked yet
-
student logs in with the key, and sudo and the console login work as before — not checked yet
Hints
0 of 3 open · they open one at a time
Hint 1
Show the solution
after 3 failed checks