0

Simple question: how can we retrieve "mobile" attribute from all member of an Active Directory with shell command "ldapsearch" ?

I can already retrieve members using the following command:

ldapsearch -LLL -x -H $LDAP_HOST -D $LDAP_USER -w $LDAP_PASS -b "OU=Security and Distribution Groups,dc=XXXXXX,dc=XX" $FILTER member

This will give the DN for all members. But as some of the DN contains special chars (like ë, ö, è, é...) I will have some encoding issue when I will use those DN to query each members.

Is there a way to get members attributes directly without querying the AD for each member DN ?

ekad
  • 14,436
  • 26
  • 44
  • 46
Gael
  • 1
  • 1

1 Answers1

0

The response to a search request always includes the distinguished name of entries that matched the search parameters. Add mobile or 0.9.2342.19200300.100.1.41 to the list of requested attributes. Assuming your search request is using the correct base object, scope, and filer, if access controls permit mobile to be read by the authorization state of the connection upon which the search is processed, it will be returned for all members that match the search parameters.

see also

Terry Gardner
  • 10,957
  • 2
  • 28
  • 38
  • Thanks for your answer. Unfortunatly the DN returned by the query may contains sometimes utf8 characters and then it is not usable in shell directly to query again the LDAP using this DN. – Gael Feb 26 '13 at 10:06
  • Is there a way to extend the query to get directly the members and not only the DN of each members ? – Gael Feb 26 '13 at 10:13
  • I finally got it ! In fact I had to change my way of thinking about my needs. Instead of looking for all the members of a specific group I search for all users having the attribute memberOf with the group as value. ldapsearch -LLL -x -H $LDAP_HOST -D $LDAP_USER -w $LDAP_PASS -b "ou=or-ch,DC=XXXX,DC=XX" (memberOf=CN=$MAILING_LIST_CN,OU=Security and Distribution Groups,DC=XXXX,DC=XX) mobile Hope it will help someone. – Gael Feb 26 '13 at 11:57
  • The link no longer seems to have useful info – Shawn Sep 09 '21 at 17:43