]> git.sur5r.net Git - openldap/blob - doc/man/man1/ldapmodify.1
8a93505a77bef3a67a9f8d2214a40d9526ed423d
[openldap] / doc / man / man1 / ldapmodify.1
1 .TH LDAPMODIFY 1 "20 August 2000" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldapmodify, ldapadd \- LDAP modify entry and LDAP add entry tools
7 .SH SYNOPSIS
8 .B ldapmodify
9 [\c
10 .BR \-a ]
11 [\c
12 .BR \-b ]
13 [\c
14 .BR \-c ]
15 [\c
16 .BR \-C ]
17 [\c
18 .BR \-r ]
19 [\c
20 .BR \-n ]
21 [\c
22 .BR \-v ]
23 [\c
24 .BR \-k ]
25 [\c
26 .BR \-K ]
27 [\c
28 .BR \-M[M] ]
29 [\c
30 .BI \-d \ debuglevel\fR]
31 [\c
32 .BI \-D \ binddn\fR]
33 [\c
34 .BR \-W ]
35 [\c
36 .BI \-w \ passwd\fR]
37 [\c
38 .BI \-H \ ldapuri\fR]
39 [\c
40 .BI \-h \ ldaphost\fR]
41 [\c
42 .BI \-p \ ldapport\fR]
43 [\c
44 .BI \-P \ 2\fR\||\|\fI3\fR]
45 [\c
46 .BR \-O \ security-properties ]
47 [\c
48 .BR \-I ]
49 [\c
50 .BR \-Q ]
51 [\c
52 .BI \-U \ username\fR]
53 [\c
54 .BR \-x ]
55 [\c
56 .BI \-X \ authzid\fR]
57 [\c
58 .BI \-Y \ mech\fR]
59 [\c
60 .BR \-Z[Z] ]
61 [\c
62 .BI \-f \ file\fR]
63 .LP
64 .B ldapadd
65 [\c
66 .BR \-b ]
67 [\c
68 .BR \-c ]
69 [\c
70 .BR \-r ]
71 [\c
72 .BR \-n ]
73 [\c
74 .BR \-v ]
75 [\c
76 .BR \-k ]
77 [\c
78 .BR \-K ]
79 [\c
80 .BR \-M[M] ]
81 [\c
82 .BI \-d \ debuglevel\fR]
83 [\c
84 .BI \-D \ binddn\fR]
85 [\c
86 .BR \-W ]
87 [\c
88 .BI \-w \ passwd\fR]
89 [\c
90 .BI \-h \ ldaphost\fR]
91 [\c
92 .BI \-p \ ldapport\fR]
93 [\c
94 .BI \-P \ 2\fR\||\|\fI3\fR]
95 [\c
96 .BR \-E[E] ]
97 [\c
98 .BR \-I[I] ]
99 [\c
100 .BI \-U \ username\fR]
101 [\c
102 .BI \-X \ authzid\fR]
103 [\c
104 .BI \-Y \ mech\fR]
105 [\c
106 .BR \-Z[Z] ]
107 [\c
108 .BI \-f \ file\fR]
109 .SH DESCRIPTION
110 .B ldapmodify
111 is a shell-accessible interface to the
112 .BR ldap_modify (3)
113 and
114 .BR ldap_add (3)
115 library calls.
116 .B ldapadd
117 is implemented as a hard link to the ldapmodify tool.  When invoked as
118 .B ldapadd
119 the -a (add new entry) flag is turned on automatically.
120 .LP
121 .B ldapmodify
122 opens a connection to an LDAP server, binds, and modifies or adds entries.
123 The entry information is read from standard input or from \fIfile\fP through
124 the use of the -f option.
125 .SH OPTIONS
126 .TP
127 .B \-a
128 Add new entries.  The default for
129 .B ldapmodify
130 is to modify existing entries.  If invoked as
131 .BR ldapadd ,
132 this flag is always set.
133 .TP
134 .B \-b
135 Assume that any values that start with a `/' are binary values and that
136 the actual value is in a file whose path is specified in the place where
137 values normally appear.
138 .TP
139 .B \-C
140 Automatically chase referrals.
141 .TP
142 .B \-c
143 Continuous operation mode.  Errors are reported, but
144 .B ldapmodify
145 will continue with modifications.  The default is to exit after
146 reporting an error.
147 .TP
148 .B \-r
149 Replace existing values by default.
150 .TP
151 .B \-n
152 Show what would be done, but don't actually modify entries.  Useful for
153 debugging in conjunction with -v.
154 .TP
155 .B \-v
156 Use verbose mode, with many diagnostics written to standard output.
157 .TP
158 .B \-k
159 Use Kerberos authentication instead of simple authentication.  It is
160 assumed that you already have a valid ticket granting ticket.  You must
161 compile with KERBEROS defined for this option to have any effect.
162 .TP
163 .B \-K
164 Same as \-k, but only does step 1 of the kerberos bind.  This is useful
165 when connecting to a slapd and there is no x500dsa.hostname principal
166 registered with your kerberos servers.
167 .TP
168 .B \-F
169 Force application of all changes regardless of the contents of input
170 lines that begin with
171 .I replica:
172 (by default, replica: lines are compared against the LDAP server host
173 and port in use to decide if a replog record should actually be applied).
174 .TP
175 .B \-M[M]
176 Enable manage DSA IT control.
177 .B \-MM
178 makes control critical.
179 .TP
180 .BI \-d \ debuglevel
181 Set the LDAP debugging level to \fIdebuglevel\fP.
182 .B ldapmodify
183 must be compiled with LDAP_DEBUG defined for this option to have any effect.
184 .TP
185 .BI \-f \ file
186 Read the entry modification information from \fIfile\fP instead of from
187 standard input.
188 .TP
189 .B \-x 
190 Use simple authentication instead of SASL.
191 .TP
192 .BI \-D \ binddn
193 Use the Distinguished Name \fIbinddn\fP to bind to the LDAP directory.
194 .TP
195 .B \-W
196 Prompt for simple authentication.
197 This is used instead of specifying the password on the command line.
198 .TP
199 .BI \-w \ passwd
200 Use \fIpasswd\fP as the password for simple authentication.
201 .TP
202 .BI \-H \ ldapuri
203 Specify URI(s) referring to the ldap server(s).
204 .TP
205 .BI \-h \ ldaphost
206 Specify an alternate host on which the ldap server is running.
207 Deprecated in favor of -H.
208 .TP
209 .BI \-p \ ldapport
210 Specify an alternate TCP port where the ldap server is listening.
211 Deprecated in favor of -H.
212 .TP
213 .BI \-P \ 2\fR\||\|\fI3
214 Specify the LDAP protocol version to use.
215 .TP
216 .BI \-O \ security-properties
217 Specify SASL security properties.
218 .TP
219 .B \-I
220 Enable SASL Interactive mode.  Always prompt.  Default is to prompt
221 only as needed.
222 .TP
223 .B \-Q
224 Enable SASL Quiet mode.  Never prompt.
225 .TP
226 .BI \-U \ username
227 Specify the username for SASL bind. The syntax of the username depends on the
228 actual SASL mechanism used.
229 .TP
230 .BI \-X \ authzid
231 Specify the requested authorization ID for SASL bind.
232 .I authzid
233 must be one of the following formats:
234 .B dn:\c
235 .I <distinguished name>
236 or
237 .B u:\c
238 .I <username>
239 .TP
240 .BI \-Y \ mech
241 Specify the SASL mechanism to be used for authentication. If it's not
242 specified, the program will choose the best mechanism the server knows.
243 .TP
244 .B \-Z[Z]
245 Issue StartTLS (Transport Layer Security) extended operation. If you use
246 .B \-ZZ\c
247 , the command will require the operation to be successful.
248 .SH INPUT FORMAT
249 The contents of \fIfile\fP (or standard input if no \-f flag is given on
250 the command line) should conform to the format defined in
251 .BR slapd.replog (5),
252 with the exceptions noted below.
253 .LP
254 If the first line of a record consists of a decimal number (entry id),
255 it is ignored.
256 .LP
257 Lines that begin with "replica:" are matched against the LDAP server host
258 and port in use to decide if a particular replog record should be applied.
259 Any other lines that precede the "dn:" line are ignored.
260 The -F flag can be used to force
261 .I ldapmodify
262 to apply all of the replog changes, regardless of the presence or
263 absence of any "replica:" lines.
264 .LP
265 If no "changetype:" line is present, the default is "add" if the -a
266 flag is set (or if the program was invoked as
267 .I ldapmodify)
268 and "modify" otherwise.
269 .LP
270 If changetype is "modify" and no "add:", "replace:", or "delete:" lines
271 appear, the default is "replace" if the -r flag is set and "add"
272 otherwise.
273 .LP
274 Note that the above exceptions to the
275 .BR slapd.replog (5)
276 format allow
277 .BR ldif (5)
278 entries to be used as input to
279 .I ldapmodify
280 or
281 .I ldapadd.
282 .SH ALTERNATIVE INPUT FORMAT
283 An alternative input format is supported for compatibility with older
284 versions of
285 .I ldapmodify.
286 This format consists of one or more entries separated by blank lines,
287 where each entry looks like:
288 .LP
289 .nf
290     Distinguished Name (DN)
291     attr=value
292     [attr=value ...]
293 .fi
294 .LP
295 where \fIattr\fP is the name of the attribute and \fIvalue\fP is the
296 value.
297 .LP
298 By default, values are added.  If the
299 .RI \- r
300 command line flag is
301 given, the default is to replace existing values with the new one.
302 Note that it is permissible for a given attribute to appear more than
303 once (for example, to add more than one value for an attribute).  Also
304 note that you can use a trailing `\\' to continue values across lines and
305 preserve newlines in the value itself (this is useful for modifying
306 QUIPU iattr attributes among others).
307 .LP
308 .I attr
309 should be preceded by a \fB-\fP to remove a value.  The `=' and
310 value should be omitted to remove an entire attribute.
311 .LP
312 .I attr
313 should be preceded by a \fB+\fP to add a value in the presence of the
314 \-r flag.
315 .LP
316 .SH EXAMPLES
317 Assuming that the file
318 .B /tmp/entrymods
319 exists and has the contents:
320 .LP
321 .nf
322     dn: cn=Modify Me, dc=example, dc=com
323     changetype: modify
324     replace: mail
325     mail: modme@OpenLDAP.org
326     -
327     add: title
328     title: Grand Poobah
329     -
330     add: jpegPhoto
331     jpegPhoto:< file://tmp/modme.jpeg
332     -
333     delete: description
334     -
335 .fi
336 .LP
337 the command:
338 .LP
339 .nf
340     ldapmodify -b -r -f /tmp/entrymods
341 .fi
342 .LP
343 will replace the contents of the "Modify Me" entry's
344 .I mail
345 attribute with the value "modme@example.com", add a
346 .I title
347 of "Grand Poobah", and the contents of the file "/tmp/modme.jpeg"
348 as a
349 .IR jpegPhoto ,
350 and completely remove the
351 .I description
352 attribute.
353 The same modifications as above can be performed using the older
354 .I ldapmodify
355 input format:
356 .LP
357 .nf
358     cn=Modify Me, dc=example, dc=com
359     mail=modme@example.com
360     +title=Grand Poobah
361     +jpegPhoto=/tmp/modme.jpeg
362     -description
363 .fi
364 .LP
365 and the command:
366 .LP
367 .nf
368     ldapmodify -b -r -f /tmp/entrymods
369 .fi
370 .LP
371 Assuming that the file
372 .B /tmp/newentry
373 exists and has the contents:
374 .LP
375 .nf
376     dn: cn=Barbara Jensen, dc=example, dc=com
377     objectClass: person
378     cn: Barbara Jensen
379     cn: Babs Jensen
380     sn: Jensen
381     title: the world's most famous mythical manager
382     mail: bjensen@example.com
383     uid: bjensen
384 .LP
385 the command:
386 .LP
387 .nf
388     ldapadd -f /tmp/entrymods
389 .fi
390 .LP
391 will add a new entry for Babs Jensen, using the values from the
392 file
393 .B /tmp/newentry.
394 .LP
395 Assuming that the file
396 .B /tmp/newentry
397 exists and has the contents:
398 .LP
399 .nf
400     dn: cn=Barbara Jensen, dc=example, dc=com
401     changetype: delete
402 .LP
403 the command:
404 .LP
405 .nf
406     ldapmodify -f /tmp/entrymods
407 .fi
408 .LP
409 will remove Babs Jensen's entry.
410 .SH DIAGNOSTICS
411 Exit status is zero if no errors occur.  Errors result in a non-zero
412 exit status and a diagnostic message being written to standard error.
413 .SH "SEE ALSO"
414 .BR ldapadd (1),
415 .BR ldapdelete (1),
416 .BR ldapmodrdn (1),
417 .BR ldapsearch (1),
418 .BR ldap.conf (5),
419 .BR ldap (3),
420 .BR ldap_add (3),
421 .BR ldap_delete (3),
422 .BR ldap_modify (3),
423 .BR ldap_modrdn (3),
424 .BR slapd.replog (5)
425 .SH BUGS
426 There is no interactive mode, but there probably should be.
427 .SH AUTHOR
428 The OpenLDAP Project <http://www.openldap.org/>
429 .SH ACKNOWLEDGEMENTS
430 .B      OpenLDAP
431 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
432 .B      OpenLDAP
433 is derived from University of Michigan LDAP 3.3 Release.