Reconnaissance and Enumeration

A tester has a low-privilege shell on a Linux host that is joined to a central directory through SSSD. The tester needs only the local accounts that can log in interactively. Which command BEST does this?

Show the answer

Correct answerD. grep -vE '(nologin|false)$' /etc/passwd

AWhy not this: getent passwd also returns directory-backed accounts and every service account, so it is neither local-only nor filtered.

BWhy not this: who shows only users currently logged in, so it misses accounts that can log in but are not active.

CWhy not this: /etc/shadow is readable only by root, so a low-privilege user is denied, and it holds no shell field.

DWhy this is right: /etc/passwd is readable by any user and shows each local account's shell, so removing nologin and false shells isolates interactive accounts.

/etc/passwd is world-readable and holds local accounts with their shells, so filtering out nologin and false shells leaves the interactive accounts. /etc/shadow needs root, and getent passwd adds directory accounts and unfiltered service accounts.