The GECOS field of the account `alice` currently reads `alice` and should read `Alice Okafor`. Select the TWO commands that write that name into the fifth field of her /etc/passwd line.
LPIC-1 Exam 102-500, objective 107. Administrative tasks medium
Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.
Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
The options
Choose 2.
Correct usermod -c "Alice Okafor" alice
Correct. -c (--comment) replaces the whole GECOS field. It is the administrative route and, being usermod, requires root.
Correct chfn -f "Alice Okafor" alice
Correct. chfn edits the GECOS field subfield by subfield: -f sets the full name, and the remaining subfields — the office or room number and the telephone numbers — have their own options, whose letters differ between the shadow and util-linux implementations. chfn is setuid so a user may run it on their own account.
Not correct chsh -s "Alice Okafor" alice
Wrong. chsh is chfn's sibling but edits the seventh field, the login shell, and -s is the shell to set. Handing it a name would record an unusable shell path.
Not correct chage -l alice
Wrong. chage manages password ageing, and -l only lists the current ageing values. It never touches /etc/passwd.
Not correct getent passwd alice
Wrong. getent reads the account databases through the Name Service Switch and prints what it finds. It is a query tool and writes nothing.
Why
The fifth field of /etc/passwd is the GECOS or comment field, conventionally a comma-separated list of full name, room, work phone and home phone, which is where finger and mail clients pick up a user's display name. Two tools write it: usermod -c replaces the field wholesale and is for administrators, while chfn edits named subfields and is deliberately setuid so that users may correct their own entry. Its sibling chsh does the same job for the login shell.
Where this comes from
- Cited
- manual page chfn(1)
Practise this
Reading one question is not practice. The trainer will draw a short set from objective 107 and space the ones you get wrong.
More questions on this objective
- The account alice already belongs to the supplementary groups audio and video. You must additionally put her in the group developers while keeping her existing memberships. Which command does that? machine-checked
- A departing employee's account bob must be deleted together with his home directory and mail spool. Which command does all of that in one step? machine-checked
- You want every newly created account to start with a company-standard .bashrc already in its home directory. Where do you place that file? machine-checked
- On a host whose accounts come partly from local files and partly from a directory service, `grep alice /etc/passwd` returns nothing even though `id alice` works. Which command shows alice's account entry the way the system itself resolves it? machine-checked
- Policy says passwords must be changed at least every 90 days, and the account carol must comply. Which command sets that maximum password age? machine-checked
- A line in /etc/group reads `developers:x:1500:alice,bob`. What does the final field contain? machine-checked