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.

Practise LPIC-1 Exam 102-500

More questions on this objective

All questions on Administrative tasks

Practise LPIC-1 Exam 102-500