Felipe_G0NZÁLEZ_SANTIAG0
2016-Nov-06 03:37 UTC
[Samba] ldap search with DN which contains space
Hello, I am trying to get all the members of a given group. I run this command: #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Administrators,CN=Builtin,DC=ejemplo,DC=cu And it works fine. BUT: problems arise when the group name contains spaces, e.g 'Domain Controllers' Then, I run: #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Domain Controllers,CN=Users,DC=ejemplo,DC=cu And this return no records. Even using 'DN' or "DN" the < no records> behaviour persists. So, How can I get the members of a group which contains spaces in its name by using ldbsearch? Or other alternative? Regards. ___________________________________________ Felipe_ González_Santiago Universidad_de_las_Ciencias_Informáticas Centro_de_Software_Libre La_Habana. CUBA "Remind yourself that you cannot fail at being yourself" Wayne Dyer
Hi Felipe Gonzalez, Am 06.11.2016 um 04:37 schrieb Felipe_G0NZÁLEZ_SANTIAG0 via samba:> Hello, I am trying to get all the members of a given group. > I run this command: > #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Administrators,CN=Builtin,DC=ejemplo,DC=cu > And it works fine. > > BUT: problems arise when the group name contains spaces, e.g 'Domain Controllers' > Then, I run: > #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Domain Controllers,CN=Users,DC=ejemplo,DC=cu > And this return no records. > Even using 'DN' or "DN" the < no records> behaviour persists. > > So, How can I get the members of a group which contains spaces in its name by using ldbsearch? Or other alternative?Put the filter in single quotes, if it contains spaces. For example: # ldbsearch -H /usr/local/samba/private/sam.ldb 'memberOf=CN=Domain Admins,CN=Users,DC=samdom,DC=example,DC=com' Regards, Marc
On Sun, 6 Nov 2016 09:55:16 +0100 Marc Muehlfeld via samba <samba at lists.samba.org> wrote:> Hi Felipe Gonzalez, > > Am 06.11.2016 um 04:37 schrieb Felipe_G0NZÁLEZ_SANTIAG0 via samba: > > Hello, I am trying to get all the members of a given group. > > I run this command: > > #ldbsearch -H /var/lib/samba/private/sam.ldb > > memberOf=CN=Administrators,CN=Builtin,DC=ejemplo,DC=cu And it works > > fine. > > > > BUT: problems arise when the group name contains spaces, e.g > > 'Domain Controllers' Then, I run: > > #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Domain > > Controllers,CN=Users,DC=ejemplo,DC=cu And this return no records. > > Even using 'DN' or "DN" the < no records> behaviour persists. > > > > So, How can I get the members of a group which contains spaces in > > its name by using ldbsearch? Or other alternative? > > > Put the filter in single quotes, if it contains spaces. For example: > # ldbsearch -H /usr/local/samba/private/sam.ldb 'memberOf=CN=Domain > Admins,CN=Users,DC=samdom,DC=example,DC=com' > > > Regards, > Marc >Or you can escape the space: ldbsearch -H /usr/local/samba/private/sam.ldb memberOf=CN=Domain\ Admins,CN=Users,DC=samdom,DC=example,DC=com Rowland
Like you allways do it on th shell, use quots: ldbsearch -H /var/lib/samba/private/sam.ldb "memberOf=CN=Domain Controllers,CN=Users,DC=ejemplo,DC=cu" or: ldbsearch -H /var/lib/samba/private/sam.ldb 'memberOf=CN=Domain Controllers,CN=Users,DC=ejemplo,DC=cu' Am 06.11.16 um 04:37 schrieb Felipe_G0NZÁLEZ_SANTIAG0 via samba:> Hello, I am trying to get all the members of a given group. > I run this command: > #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Administrators,CN=Builtin,DC=ejemplo,DC=cu > And it works fine. > > BUT: problems arise when the group name contains spaces, e.g 'Domain Controllers' > Then, I run: > #ldbsearch -H /var/lib/samba/private/sam.ldb memberOf=CN=Domain Controllers,CN=Users,DC=ejemplo,DC=cu > And this return no records. > Even using 'DN' or "DN" the < no records> behaviour persists. > > So, How can I get the members of a group which contains spaces in its name by using ldbsearch? Or other alternative? > > Regards. > ___________________________________________ > Felipe_ González_Santiago > Universidad_de_las_Ciencias_Informáticas > Centro_de_Software_Libre > La_Habana. CUBA > > "Remind yourself that you cannot fail at being yourself" > Wayne Dyer >-- Stefan Kania Landweg 13 25693 St. Michaelisdonn Signieren jeder E-Mail hilft Spam zu reduzieren. Signieren Sie ihre E-Mail. Weiter Informationen unter http://www.gnupg.org Mein Schlüssel liegt auf hkp://subkeys.pgp.net -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 203 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20161106/4218603b/signature.sig>