运行时出错 ldapsearch -H ldap:// -x -s base -b “” -LLL “+”

Error when running ldapsearch -H ldap:// -x -s base -b “” -LLL “+”

我是 LDAPOpenLDAP

的新手

当运行宁很基础ldapsearch

ldapsearch -H ldap:// -x -s base -b “” -LLL “+”

它returns

ldapsearch: invalid option -- 'H'

在 CentOS 7 中

但是如果我运行

sudo ldapsearch -H ldap:// -x -s base -b “” -LLL “+”

invalid option 错误消失了,但是 returns

Invalid DN syntax (34)
Additional information: invalid DN

我觉得我好像搞砸了一些配置,我所做的只是按照这个 tutorial

的说明

请让我知道我应该在此处提供的任何额外信息以及如何解决该问题。我真的是 (Open)LDAP.

的新手

更新

/etc/openldap/slapd.d/db.ldif

的内容
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=myname,dc=local

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=ldapadm,dc=myname,dc=local

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}123123123123123123123

Left/right 双引号 “ ” 不受 unix shell 引用机制的支持,您必须使用单引号或双引号 '' or "" 将您的参数括起来。

这应该有效:

sudo ldapsearch -H ldap:// -x -s base -b '' -LLL '+'

另见 difference between single and double quotes