我在 Fedora 上并设置了 OpenLDAP 服务器。我不记得一开始就设置过管理员密码,但我必须在提示输入管理员密码的地方执行操作。不输入任何内容是行不通的。我对这个问题进行了广泛的搜索,并尝试了以下方法:
$ ldapmodify -Q -Y EXTERNAL -H ldapi:/// << E0F
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}wDiv2teFapZFmOwSz04/2CMaYvpqfLvi
E0F
modifying entry "olcDatabase={1}mdb,cn=config"
ldap_modify: Insufficient access (50)
$ sudo -i
[sudo] password for User:
[root@localhost ~]# ldapmodify -Q -Y EXTERNAL -H ldapi:/// << E0F
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}wDiv2teFapZFmOwSz04/2CMaYvpqfLvi
E0F
modifying entry "olcDatabase={1}mdb,cn=config"
ldap_modify: Insufficient access (50)
$ ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b cn=config olcRootDN=cn=admin,dc=com,dc=example dn olcRootDN olcRootPW
SASL/EXTERNAL authentication started
SASL username: gidNumber=1000+uidNumber=1000,cn=peercred,cn=external,cn=auth
SASL SSF: 0
No such object (32)
$ sudo ldapsearch -H ldapi:/// -Y EXTERNAL -b 'cn=config'
[sudo] password for User:
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
# extended LDIF
#
# LDAPv3
# base <cn=config
> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# search result
search: 2
result: 32 No such object
# numResponses: 1
$ sudo ldapmodify -Q -Y EXTERNAL -H ldapi:/// << E0F
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}wDiv2teFapZFmOwSz04/2CMaYvpqfLvi
E0F
modifying entry "olcDatabase={1}mdb,cn=config"
ldap_modify: Insufficient access (50)
我还将以上内容放入一个文件中并尝试这样做:
$ vim pw_reset.ldif
$ sudo ldapmodify -Y EXTERNAL -D 'cn=config' -H ldapi:/// -f ./pw_reset.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "olcDatabase={1}mdb,cn=config"
ldap_modify: Insufficient access (50)
因此,这里明显的问题是,无论如何,我似乎没有“足够的访问权限”,这就是这里的问题。我需要管理员密码来设置管理员密码。正确的方法是什么?