从ldif文件恢复openldapconfiguration?

我正试图恢复我的OpenLDAP服务器从我做的一个ldif文件,它可怕的错误之前。

所有我发现的网站谈到使用slapadd但是当我运行slapadd -v -l ~ns01/openldap_config.ldif它返回错误Could not stat config file "/etc/ldap/slapd.conf" : No such file or directory (2) slapadd: bad configuration file!

当我查看目录时确实文件不存在,但是这是因为Ubuntu 11.10在RTC模式下运行,所以我的LD​​AP服务器使用/etc/slapd.d/cn=config进行configuration。 所以? 我错过了什么? slapadd是使用错误的工具吗?

正如我上面所说,我在Ubuntu 11.10服务器版64位上运行。

仔细查看文档,看起来好像您可以使用slapadd-F标志来指定一个configuration目录,而不是一个configuration文件:

  -F confdir specify a config directory. If both -f and -F are specified, the config file will be read and converted to config directory format and written to the specified directory. If neither option is specified, an attempt to read the default config directory will be made before trying to use the default config file. If a valid config directory exists then the default config file is ignored. If dry-run mode is also specified, no conver‐ sion will occur. 

如果这不起作用(例如,你错过了你的cn = config树的内容),可能这个线程有一些build议。

尝试这个:

 sudo ldapadd -Q -Y EXTERNAL -H ldapi:/// -f yourfile.ldif 

应该为Ubuntu 11.10工作,虽然我仍然在探索这个新的cn=config东西。

我用过这个:

ldapadd -c -x -H ldap://localhost:389 -D "dc=Manager,dc=example,dc=com" -w password -f /tmp/backup.ldif

https://github.com/gschueler/vagrant-rundeck-ldap/blob/master/load-ldif.sh修改