It has access to the users listed in
with a valid shell.
Something like this:
cat /etc/passwd | grep -E '/bin/(bash|sh)$' | grep -Eo '^\\w+'
This is an example for the popular shells (bash and sh), they are all listed in
UPD: in this version scans all active Shelah in the system (thanks to Boris semov
for the comments)
while read SHELL; do cat /etc/passwd | grep -E "$SHELL$" | grep -Eo '^\\w+'; done < /etc/shells