]> git.sur5r.net Git - openldap/blob - doc/man/man1/ldapmodify.1
113fdac77872c60957e9574d91f1d18b210c087b
[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 .BI \-U \ username\fR]
47 [\c
48 .BR \-x ]
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 .B \-x 
184 Use simple authentication instead of SASL.
185 .TP
186 .BI \-D \ binddn
187 Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
188 a string-represented DN as defined in RFC 1779.
189 .TP
190 .B \-W
191 Prompt for simple authentication.
192 This is used instead of specifying the password on the command line.
193 .TP
194 .BI \-w \ passwd
195 Use \fIpasswd\fP as the password for simple authentication.
196 .TP
197 .BI \-h \ ldaphost
198 Specify an alternate host on which the ldap server is running.
199 .TP
200 .BI \-p \ ldapport
201 Specify an alternate TCP port where the ldap server is listening.
202 .TP
203 .BI \-P \ 2\fR\||\|\fI3
204 Specify the LDAP protocol version to use.
205 .TP
206 .BI \-O \ security-properties
207 Specify SASL security properties.
208 .TP
209 .BI \-U \ username
210 Specify the username for SASL bind. The syntax of the username depends on the
211 actual SASL mechanism used.
212 .TP
213 .BI \-X \ authzid
214 Specify the requested authorization ID for SASL bind.
215 .I authzid
216 must be one of the following formats:
217 .B dn:\c
218 .I <distinguished name>
219 or
220 .B u:\c
221 .I <username>
222 .TP
223 .BI \-Y \ mech
224 Specify the SASL mechanism to be used for authentication. If it's not
225 specified, the program will choose the best mechanism the server knows.
226 .TP
227 .B \-Z[Z]
228 Issue StartTLS (Transport Layer Security) extended operation. If you use
229 .B \-ZZ\c
230 , the command will require the operation to be successful.
231 .SH INPUT FORMAT
232 The contents of \fIfile\fP (or standard input if no \-f flag is given on
233 the command line) should conform to the format defined in
234 .BR slapd.replog (5),
235 with the exceptions noted below.
236 .LP
237 If the first line of a record consists of a decimal number (entry id),
238 it is ignored.
239 .LP
240 Lines that begin with "replica:" are matched against the LDAP server host
241 and port in use to decide if a particular replog record should be applied.
242 Any other lines that precede the "dn:" line are ignored.
243 The -F flag can be used to force
244 .I ldapmodify
245 to apply all of the replog changes, regardless of the presence or
246 absence of any "replica:" lines.
247 .LP
248 If no "changetype:" line is present, the default is "add" if the -a
249 flag is set (or if the program was invoked as
250 .I ldapmodify)
251 and "modify" otherwise.
252 .LP
253 If changetype is "modify" and no "add:", "replace:", or "delete:" lines
254 appear, the default is "replace" if the -r flag is set and "add"
255 otherwise.
256 .LP
257 Note that the above exceptions to the
258 .BR slapd.replog (5)
259 format allow
260 .BR ldif (5)
261 entries to be used as input to
262 .I ldapmodify
263 or
264 .I ldapadd.
265 .SH ALTERNATIVE INPUT FORMAT
266 An alternative input format is supported for compatibility with older
267 versions of
268 .I ldapmodify.
269 This format consists of one or more entries separated by blank lines,
270 where each entry looks like:
271 .LP
272 .nf
273     Distinguished Name (DN)
274     attr=value
275     [attr=value ...]
276 .fi
277 .LP
278 where \fIattr\fP is the name of the attribute and \fIvalue\fP is the
279 value.
280 .LP
281 By default, values are added.  If the
282 .RI \- r
283 command line flag is
284 given, the default is to replace existing values with the new one.
285 Note that it is permissible for a given attribute to appear more than
286 once (for example, to add more than one value for an attribute).  Also
287 note that you can use a trailing `\\' to continue values across lines and
288 preserve newlines in the value itself (this is useful for modifying
289 QUIPU iattr attributes among others).
290 .LP
291 .I attr
292 should be preceded by a \fB-\fP to remove a value.  The `=' and
293 value should be omitted to remove an entire attribute.
294 .LP
295 .I attr
296 should be preceded by a \fB+\fP to add a value in the presence of the
297 \-r flag.
298 .LP
299 .SH EXAMPLES
300 Assuming that the file
301 .B /tmp/entrymods
302 exists and has the contents:
303 .LP
304 .nf
305     dn: cn=Modify Me, dc=OpenLDAP, dc=Org
306     changetype: modify
307     replace: mail
308     mail: modme@OpenLDAP.org
309     -
310     add: title
311     title: Grand Poobah
312     -
313     add: jpegPhoto
314     jpegPhoto:< file://tmp/modme.jpeg
315     -
316     delete: description
317     -
318 .fi
319 .LP
320 the command:
321 .LP
322 .nf
323     ldapmodify -b -r -f /tmp/entrymods
324 .fi
325 .LP
326 will replace the contents of the "Modify Me" entry's
327 .I mail
328 attribute with the value "modme@OpenLDAP.org", add a
329 .I title
330 of "Grand Poobah", and the contents of the file "/tmp/modme.jpeg"
331 as a
332 .IR jpegPhoto ,
333 and completely remove the
334 .I description
335 attribute.
336 The same modifications as above can be performed using the older
337 .I ldapmodify
338 inout format:
339 .LP
340 .nf
341     cn=Modify Me, dc=OpenLDAP, dc=org
342     mail=modme@OpenLDAP.org
343     +title=Grand Poobah
344     +jpegPhoto=/tmp/modme.jpeg
345     -description
346 .fi
347 .LP
348 and the command:
349 .LP
350 .nf
351     ldapmodify -b -r -f /tmp/entrymods
352 .fi
353 .LP
354 Assuming that the file
355 .B /tmp/newentry
356 exists and has the contents:
357 .LP
358 .nf
359     dn: cn=Barbara Jensen, dc=OpenLDAP, dc=org 
360     objectClass: person
361     cn: Barbara Jensen
362     cn: Babs Jensen
363     sn: Jensen
364     title: the world's most famous mythical manager
365     mail: bjensen@OpenLDAP.org
366     uid: bjensen
367 .LP
368 the command:
369 .LP
370 .nf
371     ldapadd -f /tmp/entrymods
372 .fi
373 .LP
374 will add a new entry for Babs Jensen, using the values from the
375 file
376 .B /tmp/newentry.
377 .LP
378 Assuming that the file
379 .B /tmp/newentry
380 exists and has the contents:
381 .LP
382 .nf
383     dn: cn=Barbara Jensen, dc=OpenLDAP, dc=org
384     changetype: delete
385 .LP
386 the command:
387 .LP
388 .nf
389     ldapmodify -f /tmp/entrymods
390 .fi
391 .LP
392 will remove Babs Jensen's entry.
393 .SH DIAGNOSTICS
394 Exit status is 0 if no errors occur.  Errors result in a non-zero exit
395 status and a diagnostic message being written to standard error.
396 .SH "SEE ALSO"
397 .BR ldapadd (1),
398 .BR ldapdelete (1),
399 .BR ldapmodrdn (1),
400 .BR ldapsearch (1),
401 .BR ldap.conf (5),
402 .BR ldap (3),
403 .BR ldap_add (3),
404 .BR ldap_delete (3),
405 .BR ldap_modify (3),
406 .BR ldap_modrdn (3),
407 .BR slapd.replog (5)
408 .LP
409 Kille, S.,
410 .IR "A String Representation of Distinguished Names",
411 .SM RFC
412 1779,
413 ISODE Consortium, March 1995.
414 .SH BUGS
415 There is no interactive mode, but there probably should be.
416 .SH AUTHOR
417 The OpenLDAP Project <http://www.openldap.org/>
418 .SH ACKNOWLEDGEMENTS
419 .B      OpenLDAP
420 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
421 .B      OpenLDAP
422 is derived from University of Michigan LDAP 3.3 Release.