LX0-104 · Question #350
When logged in to a workstation which retrieves most of its user information from NIS, which command can be used to list ALL the users?
The correct answer is D. getent passwd. The getent passwd command is the standard way to retrieve user information from all configured name service sources, including NIS, as defined in /etc/nsswitch.conf.
Question
Options
- Acat /etc/passwd
- Bshow users
- Cypusers list
- Dgetent passwd
- Ecat /var/lib/nis/passwd
How the community answered
(26 responses)- C8% (2)
- D88% (23)
- E4% (1)
Why each option
The `getent passwd` command is the standard way to retrieve user information from all configured name service sources, including NIS, as defined in `/etc/nsswitch.conf`.
The `cat /etc/passwd` command only displays users defined locally on the system, not those from NIS.
`show users` is not a standard Unix/Linux command for listing all users from NIS.
`ypusers list` is not a standard NIS command; `ypcat passwd` would list the NIS password map but is less comprehensive than `getent`.
The `getent` utility is designed to query databases configured in `/etc/nsswitch.conf`, which includes NIS if properly configured, allowing it to list users from both local and network sources.
`cat /var/lib/nis/passwd` directly reads the NIS map file, which is not the standard or recommended way to query NIS for user information and may not be present or readable.
Concept tested: NIS user listing commands
Source: https://man7.org/linux/man-pages/man1/getent.1.html
Topics
Community Discussion
No community discussion yet for this question.