I want to find out what 'normal' users are available on a system. By normal, I mean those who are manually created, not those like sshd or gdm.
|
Typically "normal users" are assigned user ID's >= 1000. If this is the case on your system, then the following could work:
|
|||
|
|
|
Do Explanation: Whenever a user is manually added, it grabs the first available UID >= the UID_MIN value from login.defs (unless UID is manually specified) |
|||||
|
|
I don't think there's a way to tell which users have been "manually created". Probably the best you can do is look for users that have a valid shell, as typically system users like sshd and gdm have shells like
If you just want usernames:
|
|||
|
|
But that's also not the most reliable source. If once logged in:
|
|||||
|