# Get the list of members for LDAP group

**URL:** https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798
**Category:** General Usage
**Tags:** question, ldap
**Created:** [February 6, 2024, 12:53pm UTC](https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798 "2024-02-06T12:53:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![aww-r](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aww-r/32/206807_2.png) [@aww-r](https://discourse.julialang.org/u/aww-r)
#### Post date: [February 6, 2024, 12:53pm UTC](https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798/1 "2024-02-06T12:53:42Z")

</div>

I have a question in regards to LDAP, or specifically LDAP.Client package. I’d like to list all the members of specific LDAP group but I cannot make it working with the package. If I enter into bash below code I’m getting a list of members attached to the group

`/usr/bin/ldapsearch -LLL -x -h ldap.mycompany.com -s sub -b 'ou=Groups,o=mycompany.com' '(cn=my_ldap_group_to_list_members)' memberuid`

I’d like to replicate the same in Julia but cannot succeed, do you have any hint on how to do it in Julia?

---

<div class="post-metadata">

### Author: ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)
#### Post date: [October 22, 2024, 7:36pm UTC](https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798/2 "2024-10-22T19:36:08Z")

</div>

Your `ldapsearch` command uses anonymous mode. This was recently implemented in LDAPClient.jl, so something like the following should work:

```julia
using LDAPClient

server = "ldap://ldap.mycompany.com"
base = "ou=Groups,o=mycompany.com"
filter = "(cn=my_ldap_group_to_list_members)"

conn = LDAPClient.LDAPConnection(server)
LDAPClient.simple_bind(conn)
res = LDAPClient.search(conn, base, LDAPClient.LDAP_SCOPE_SUBTREE; filter)
for entry in LDAPClient.each_entry(res)
    println(entry["memberuid"])
end
LDAPClient.unbind(conn)

```
