Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle user primary group in AD #1

Open
whitlockjc opened this issue Nov 15, 2015 · 0 comments
Open

Handle user primary group in AD #1

whitlockjc opened this issue Nov 15, 2015 · 0 comments

Comments

@whitlockjc
Copy link
Owner

In an AD environment a user's primary group is not stored in the member attribute. Instead, the group's RID value is stored in the primaryGroupID attribute of the user. To find the user's primary group name you need to find the domain SID and then search for the group that has the SID value domain SID-group RID in their objectSid attribute. Attached is an example for finding a user's primary group written using py-ldap. The function sid2str is borrowed from web2ldap. I have some more on AD primary groups here:

http://blogs.freebsdish.org/tmclaugh/2010/07/21/finding-a-users-primary-group-in-ad/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant