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