2

I have a samba4-based domain. How can I list all of the groups to which given user belongs?

I know I can go the reverse way - iterate via all the groups [ samba-tool group list ] and see their membership [ samba-tool group listmembers $groupName ], but maybe there's more straightforward way?

2 Answers 2

1

I don't think samba-tool has anything for that, but LDAP is more powerful for this kind of queries, e.g.

ldapsearch -LLL -b "dc=example,dc=com" "(&(cn=*)(memberUid=user))" dn
1

You can use ''id'':

$ id eduardomozart
uid=3000011(NETHOUSE\eduardomozart) gid=100(users) grupos=100(users),3000011(NETHOUSE\eduardomozart),3000005(NETHOUSE\domain admins),3000002(NETHOUSE\denied rodc password replication group),3000002(NETHOUSE\denied rodc password replication group),3000009(NETHOUSE\dimension-e521$),3000000(BUILTIN\administrators)

Notice that for idmap_ad backend, the user need to have the attributes uidNumber and gidNumber set at LDAP (Unix Attributes tab from Active Directory User and Computers) as RFC2307 or the command will return "id: eduardomozart: no such user".

Reference: Gerald Carter, Jay Ts, Robert Eckstein, 2007. Using Samba: A File & Print Server for Linux, Unix & Mac OS X. (3rd Edition). O'Reilly, ISBN 0-596-00769-8.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .