[Samba] ldap search with DN which contains space

Marc Muehlfeld mmuehlfeld at samba.org
Sun Nov 6 08:55:16 UTC 2016

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


More information about the samba mailing list