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