how to get list of user groups from NT?

Tim Potter tpot at linuxcare.com.au
Wed Mar 28 03:01:56 GMT 2001


Ben Johnson writes:

> short version:  what is/are the api number(s) of the getgroups and
> getgroupnames remote api call in smb?  I want to fetch a list of groups
> associated with a logged in user and don't know where to look for info
> like this.

The call you are after is samr_query_usergroups() which
takes a user and returns the groups the user is a member of.

> long version:
> Please accept my apologize in advance if this is a FAQ or is documented
> somewhere.  I would love to rtfm if I knew where to look.  I couldn't
> find any message in the mail archive about this.  Someone told me
> winbind might be what I need but I haven't been able to find that
> either.  please send me a link.

If you want to set up winbind, you can use the -r option of the
wbinfo command to get the groups for a particular user.  However,
that would be a bit of effort.

An easier way would be to use rpcclient and run the "queryusergroups"
function.  I haven't tried this recently though.

> My major stumbling block is the api code number.  I can't tell what it
> is from the old source.  How exactly parameters are passed and received
> is not all the clear either. Any other tips you care to share about this
> task will be greatly appreciated.

If you're really keen, you can trace through the
cli_samr_query_usergroups() in the HEAD branch in
libsmb/cli_samr.c for how this function is implemented.


Tim.





More information about the samba-technical mailing list