It has access to the users listed in
/etc/passwd
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
/etc/shells
.
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