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