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