List of users on Unix/Linux

(imported topic written by buckwem)

With Windows ‘local user of’ can return the list of local user IDs. I have looked through the manuals and not found the equivalent for Unix/Linux.

Any ideas?

Mark

(imported comment written by Lee Wei)

The “local user” inspector is Windows only, so not useful for UNIX/Linux.

There are no built-in inspector, so we will have to go directly to the OS.

My UNIX/Linux is getting old, but if /etc/passwd is still the source for user accounts, my thinking would be to use that and filter out system ids.

Suppose that anything under 1000 are reserved for built in account then we can try the following. I assume that the password field is just an X.

preceding texts of firsts “:” of lines whose (preceding text of first “:” of following text of first “:x:” of it) as integer > 999) of file “/etc/passwd”

Lee Wei

(imported comment written by buckwem)

Thanks - I used

(preceding texts of firsts “:” of lines of it) of file “/etc/passwd”

Mark

Hi Lee,

i have requirement to send a report monthly with list of users and last login date… i want to automate this one now.

by using the "preceding texts of firsts “:” of lines of it) of file “/etc/passwd” i am getting the list of user names on the server but i want to pull out a report as below could you please help me with this pls.

UserName : Last login Data and time

Thanks.
Naresh.

…and how would you determine this from the system? If you can identify what files you would look at to determine this manually, those of us in this forum might be able to help you learn how to check that in BigFix.

I know this thread is a bit dated but I am looking to pull the local users from my Linux servers. I was trying a different method which was running a script to send output to a file but the file always ends up empty, Local User Account Info Linux. I found this thread and when trying keep getting this error -
Q: (preceding texts of firsts “:” of lines of it) of file “/etc/passwd”
E: This expression contained a character which is not allowed.

What is the character which is not allowed?

It appears to me to be the “Smart Quotes”, caused sometimes by copy/paste through Word documents or sometimes from this forum. Try deleting and retyping all of the doublequote characters.

1 Like

Brilliant!! Not so smart are they?

Thanks Jason!

1 Like