LDAP Shell Commands :: ldapadd
Ldapadd opens a connection to an
LDAP server, binds and adds entries. The entries information is read from standard input or from a file. Ldapadd is implemented as a hard link to ldapmodify with the -a flag turned on.
| ldapadd |
[-c] [-S file] [-n] [-v] [-k] [-K] [-M[M]]
[-d debuglevel] [-D binddn] [-W] [-w passwd]
[-y passwdfile] [-h ldaphost] [-p ldap-port]
[-P 2|3] [-O security-properties] [-I] [-Q]
[-U authcid] [-R realm] [-x] [-X authzid]
[-Y mech] [-Z[Z]] [-f file] |
| -c |
Continuous operation mode. If an error is found when an entry is being added, it is reported, but ldapadd will continue with adds. |
|
-h ldaphost |
Specifies and alternate host on which LDAP server is running |
| -p ldapport |
Specifies the TCP port where LDAP server is listening |
| -D binddn |
Binddn is the distinguished name used to bind to LDAP server |
| -w passwd |
Use passwd as the password for simple authentication |
-f file
|
Read the entries to add from file. |
The following command:
ldapadd -c -h 10.63.3.200 -p 1389
-D "cn=James Bond, ou=people, dc=mycompany, dc=com"
-w drymartini -f /tmp/BondEnemies.ldif
will try to add, binding as "cn=James Bond..." to the LDAP server in host 10.63.3.200 listening on port 1389, the entries defined in file "/tmp/BondEnemies.ldif" skipping the ones that return an error.
The input (file or standard input) expected by ldapadd command is also written in ldif format. A valid (if the schema is well defined) "/tmp/BondEnemies.ldif" file for the example would be
dn: id=47,ou=people,dc=mycompany,dc=com
objectClass: person
objectClass: villain
name: Dr. No
userpassword: ruletheworld
organization: Spectra
dangerLevel: 7
dn: id=53,ou=people,dc=mycompany,dc=com
objectClass: person
objectClass: villain
name: Goldfinger
userpassword: nomore007
organization: Stand-alone villain
dangerLevel: 8
If no errors occur, the command will return a zero. Errors result in a non-zero exit status and a diagnostic message being written to standard error.