将条目添加到 ldap 数据库时出现“slapadd:无效选项”

将条目添加到 ldap 数据库时出现“slapadd:无效选项”

我正在尝试将初始条目添加到我的 ldap 数据库(CentOS 版本 5.11 - LDAP 版本 2.3.43-29.el5_11 ),由于某种原因,我收到以下错误

[root@centos openldap-servers-2.3.43]# slapadd -n 2 -1 /root/root.ldif 
slapadd: invalid option -- 1
usage: slapadd [-v] [-d debuglevel] [-f configfile] [-F configdir] [-c]
        [-g] [-n databasenumber | -b suffix]
        [-l ldiffile] [-q] [-u] [-s] [-w]

我已将根 ldif 文件放入其中/root/,下面是代码

#root
dn: dc=server1,dc=com
dc: server1
objectClass: dcObject
obectClass: organizationalUnit
ou: server1.com

#staff
dn: ou=staff,dc=server1,dc=com
ou: staff
objectClass: organizationalUnit
~     

以下是 slapd.conf 的部分

#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema

# Allow LDAPv2 client connections.  This is NOT the default.
allow bind_v2

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral       ldap://root.openldap.org

pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args

# Load dynamic backend modules:
# modulepath    /usr/lib/openldap

# Modules available in openldap-servers-overlays RPM package
# Module syncprov.la is now statically linked with slapd and there
# is no need to load it here
# moduleload accesslog.la
# moduleload auditlog.la

我在这里缺少什么建议吗?

答案1

看来您使用了-1(one) 标志而不是-l(ell) 标志 - 很容易将这两个标志弄错!试试这个:

slapadd -n 2 -l /root/root.ldif

相关内容