Linux users in relevance - why only root?

(imported topic written by SystemAdmin)

Hi folks,

does anyone know why it works in this way? Seems not quite right…

Q: names of users

A: root

A: root

A: root

T: 1050

Q: exists user whose (name of it equals “oracle”)

A: False

T: 1630

Q: exists user whose (name of it equals “apache” )

A: False

T: 1179

Q: exists user whose (name of it equals “root”)

A: True

T: 1082

I know a workaround - take preceding text of first : of every line of /etc/passwd but this is not as nice as checking if the user exists…

(imported comment written by MarkA.Stevens)

Piotr,

I would bet if you ran the ‘last’ command you would find out there are 3 users logged in as root. I believe ‘names of users’ returns those who are logged in. Not processes running under a username. The following might help you in extracting information from /etc/passwd in the future:

Q: ((parenthesized part 1 of it) of (matches (regex "

(

:+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

^:

+):(.*)$") of (lines of file “/etc/passwd” as string)) as string)

A: root

A: bin

A: daemon

A: adm

A: lp

A: sync

A: shutdown

IHTH … Mark