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