nerdexam
Linux_Foundation

LFCS · 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 appropriate utility on Unix-like systems to comprehensively list all users by querying various name service databases, including NIS.

Submitted by ngozi_ng· Apr 18, 2026User and Group Management

Question

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?

Options

  • Acat /etc/passwd
  • Bshow users
  • Cypusers list
  • Dgetent passwd
  • Ecat /var/lib/nis/passwd

How the community answered

(30 responses)
  • A
    7% (2)
  • B
    3% (1)
  • D
    87% (26)
  • E
    3% (1)

Why each option

The `getent passwd` command is the appropriate utility on Unix-like systems to comprehensively list all users by querying various name service databases, including NIS.

Acat /etc/passwd

`cat /etc/passwd` will only display users defined in the local password file and will not show users sourced from NIS.

Bshow users

`show users` is not a standard Unix command for listing system users, especially from NIS.

Cypusers list

`ypusers list` is not a valid or standard NIS command for listing users; while `ypcat passwd` could list NIS password map entries, `getent passwd` is the more generalized solution.

Dgetent passwdCorrect

The `getent passwd` command queries the Name Service Switch (NSS) configuration, which is designed to retrieve user information from all configured sources, including local files (`/etc/passwd`), NIS, or LDAP, thereby providing a complete list of all accessible users.

Ecat /var/lib/nis/passwd

`cat /var/lib/nis/passwd` would attempt to read raw NIS map files, which are server-side and not directly parsed by clients to list users comprehensively, and this path is not universally standard for client user enumeration.

Concept tested: Unix command for NIS user enumeration

Source: https://man7.org/linux/man-pages/man1/getent.1.html

Topics

#NIS#User Management#getent command#Name Service Switch

Community Discussion

No community discussion yet for this question.

Full LFCS Practice