0

How to enumerate users and users groups on local OSX machine, to get same result as you can get from Workgroup Manager?

If I try to use OpenDirectory API, I have dozens of users like _svn, _sshd and so on. Is there any legit way to select only user account and user groups that could be used for login?

Probably OpenDirectory is not only one option, or there are some flags to filter user accounts?

Short answer: After playing with workgroup manager get message, that ID lesser than 500 is reserved for system usage and is not displayed by default. No hidden attributes, not complicated logic, just greater than 500.

Ation
  • 731
  • 7
  • 16
  • I'm also wondering is it ok to filter users and groups by id, if it's bigger than 500 - it "real" users or group. – Ation Aug 27 '13 at 12:32
  • I think the following SO question will get you some way there; and then perhaps filter all users who's name doesn't start with `_` and are member of the group `staff`? http://stackoverflow.com/questions/1303561/list-of-all-users-and-groups – trojanfoe Aug 27 '13 at 12:45
  • Using "staff" as a group could work for a user accounts. But how to deal with groups itself? – Ation Aug 27 '13 at 13:19
  • Sorry, I've no idea. You could assume all names starting with `_` are system accounts/groups and should be ignored? – trojanfoe Aug 27 '13 at 13:21
  • `dscl -plist . readall /users` Users have a password set while daemons have *. Users have UID above 500. Users have a default shell. Users often have a real name. Users often (always?) have a picture set. – Pétur Ingi Egilsson Aug 27 '13 at 14:34

0 Answers0