]> git.sur5r.net Git - openldap/blob - doc/man/man1/ldapmodify.1
b91241def35cbde4b734332c8058538c1d1d2288
[openldap] / doc / man / man1 / ldapmodify.1
1 .TH LDAPMODIFY 1 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2005 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 \-c ]
13 [\c
14 .BI \-S \ file\fR]
15 [\c
16 .BR \-n ]
17 [\c
18 .BR \-v ]
19 [\c
20 .BR \-k ]
21 [\c
22 .BR \-K ]
23 [\c
24 .BR \-M[M] ]
25 [\c
26 .BI \-d \ debuglevel\fR]
27 [\c
28 .BI \-D \ binddn\fR]
29 [\c
30 .BR \-W ]
31 [\c
32 .BI \-w \ passwd\fR]
33 [\c
34 .BI \-y \ passwdfile\fR]
35 [\c
36 .BI \-H \ ldapuri\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 \ authcid\fR]
51 [\c
52 .BI \-R \ realm\fR]
53 [\c
54 .BR \-x ]
55 [\c
56 .BI \-X \ authzid\fR]
57 [\c
58 .BI \-Y \ mech\fR]
59 [\c
60 .BR \-Z[Z] ]
61 [\c
62 .BI \-f \ file\fR]
63 .LP
64 .B ldapadd
65 [\c
66 .BR \-c ]
67 [\c
68 .BI \-S \ file\fR]
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 \-y \ passwdfile\fR]
89 [\c
90 .BI \-h \ ldaphost\fR]
91 [\c
92 .BI \-p \ ldapport\fR]
93 [\c
94 .BI \-P \ 2\fR\||\|\fI3\fR]
95 [\c
96 .BR \-O \ security-properties ]
97 [\c
98 .BR \-I ]
99 [\c
100 .BR \-Q ]
101 [\c
102 .BI \-U \ authcid\fR]
103 [\c
104 .BI \-R \ realm\fR]
105 [\c
106 .BR \-x ]
107 [\c
108 .BI \-X \ authzid\fR]
109 [\c
110 .BI \-Y \ mech\fR]
111 [\c
112 .BR \-Z[Z] ]
113 [\c
114 .BI \-f \ file\fR]
115 .SH DESCRIPTION
116 .B ldapmodify
117 is a shell-accessible interface to the
118 .BR ldap_modify (3)
119 and
120 .BR ldap_add (3)
121 library calls.
122 .B ldapadd
123 is implemented as a hard link to the ldapmodify tool.  When invoked as
124 .B ldapadd
125 the -a (add new entry) flag is turned on automatically.
126 .LP
127 .B ldapmodify
128 opens a connection to an LDAP server, binds, and modifies or adds entries.
129 The entry information is read from standard input or from \fIfile\fP through
130 the use of the -f option.
131 .SH OPTIONS
132 .TP
133 .B \-a
134 Add new entries.  The default for
135 .B ldapmodify
136 is to modify existing entries.  If invoked as
137 .BR ldapadd ,
138 this flag is always set.
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 .BI \-S \ file
147 Add or change records which where skipped due to an error are written to \fIfile\fP 
148 and the error message returned by the server is added as a comment. Most useful in 
149 conjunction with -c.
150 .TP
151 .B \-n
152 Show what would be done, but don't actually modify entries.  Useful for
153 debugging in conjunction with -v.
154 .TP
155 .B \-v
156 Use verbose mode, with many diagnostics written to standard output.
157 .TP
158 .B \-k
159 Use Kerberos IV authentication instead of simple authentication.  It is
160 assumed that you already have a valid ticket granting ticket.  You must
161 compile with Kerberos support for this option to have any effect.
162 .TP
163 .B \-K
164 Same as \-k, but only does step 1 of the Kerberos IV bind.  This is useful
165 when connecting to a slapd and there is no x500dsa.hostname principal
166 registered with your Kerberos Domain Controller(s).
167 .TP
168 .B \-F
169 Force application of all changes regardless of the contents of input
170 lines that begin with
171 .I replica:
172 (by default, replica: lines are compared against the LDAP server host
173 and port in use to decide if a replog record should actually be applied).
174 .TP
175 .B \-M[M]
176 Enable manage DSA IT control.
177 .B \-MM
178 makes control critical.
179 .TP
180 .BI \-d \ debuglevel
181 Set the LDAP debugging level to \fIdebuglevel\fP.
182 .B ldapmodify
183 must be compiled with LDAP_DEBUG defined for this option to have any effect.
184 .TP
185 .BI \-f \ file
186 Read the entry modification information from \fIfile\fP instead of from
187 standard input.
188 .TP
189 .B \-x 
190 Use simple authentication instead of SASL.
191 .TP
192 .BI \-D \ binddn
193 Use the Distinguished Name \fIbinddn\fP to bind to the LDAP directory.
194 .TP
195 .B \-W
196 Prompt for simple authentication.
197 This is used instead of specifying the password on the command line.
198 .TP
199 .BI \-w \ passwd
200 Use \fIpasswd\fP as the password for simple authentication.
201 .TP
202 .BI \-y \ passwdfile
203 Use complete contents of \fIpasswdfile\fP as the password for
204 simple authentication.
205 .TP
206 .BI \-H \ ldapuri
207 Specify URI(s) referring to the ldap server(s); only the protocol/host/port
208 fields are allowed; a list of URI, separated by whitespace or commas
209 is expected.
210 .TP
211 .BI \-h \ ldaphost
212 Specify an alternate host on which the ldap server is running.
213 Deprecated in favor of -H.
214 .TP
215 .BI \-p \ ldapport
216 Specify an alternate TCP port where the ldap server is listening.
217 Deprecated in favor of -H.
218 .TP
219 .BI \-P \ 2\fR\||\|\fI3
220 Specify the LDAP protocol version to use.
221 .TP
222 .BI \-O \ security-properties
223 Specify SASL security properties.
224 .TP
225 .B \-I
226 Enable SASL Interactive mode.  Always prompt.  Default is to prompt
227 only as needed.
228 .TP
229 .B \-Q
230 Enable SASL Quiet mode.  Never prompt.
231 .TP
232 .BI \-U \ authcid
233 Specify the authentication ID for SASL bind. The form of the ID
234 depends on the actual SASL mechanism used.
235 .TP
236 .BI \-R \ realm
237 Specify the realm of authentication ID for SASL bind. The form of the realm
238 depends on the actual SASL mechanism used.
239 .TP
240 .BI \-X \ authzid
241 Specify the requested authorization ID for SASL bind.
242 .I authzid
243 must be one of the following formats:
244 .B dn:\c
245 .I <distinguished name>
246 or
247 .B u:\c
248 .I <username>
249 .TP
250 .BI \-Y \ mech
251 Specify the SASL mechanism to be used for authentication. If it's not
252 specified, the program will choose the best mechanism the server knows.
253 .TP
254 .B \-Z[Z]
255 Issue StartTLS (Transport Layer Security) extended operation. If you use
256 .B \-ZZ\c
257 , the command will require the operation to be successful.
258 .SH INPUT FORMAT
259 The contents of \fIfile\fP (or standard input if no \-f flag is given on
260 the command line) should conform to the format defined in
261 .BR slapd.replog (5),
262 with the exceptions noted below.
263 .LP
264 Lines that begin with "replica:" are matched against the LDAP server host
265 and port in use to decide if a particular replog record should be applied.
266 Any other lines that precede the "dn:" line are ignored.
267 The -F flag can be used to force
268 .I ldapmodify
269 to apply all of the replog changes, regardless of the presence or
270 absence of any "replica:" lines.
271 .LP
272 If no "changetype:" line is present, the default is "add" if the -a
273 flag is set (or if the program was invoked as
274 .I ldapadd)
275 and "modify" otherwise.
276 .LP
277 If changetype is "modify" and no "add:", "replace:", or "delete:" lines
278 appear, the default is "replace" for
279 .BR ldapmodify (1)
280 and "add" for
281 .BR ldapadd (1).
282 .LP
283 Note that the above exceptions to the
284 .BR slapd.replog (5)
285 format allow
286 .BR ldif (5)
287 entries to be used as input to
288 .I ldapmodify
289 or
290 .I ldapadd.
291 .SH EXAMPLES
292 Assuming that the file
293 .B /tmp/entrymods
294 exists and has the contents:
295 .LP
296 .nf
297     dn: cn=Modify Me,dc=example,dc=com
298     changetype: modify
299     replace: mail
300     mail: modme@example.com
301     -
302     add: title
303     title: Grand Poobah
304     -
305     add: jpegPhoto
306     jpegPhoto:< file:///tmp/modme.jpeg
307     -
308     delete: description
309     -
310 .fi
311 .LP
312 the command:
313 .LP
314 .nf
315     ldapmodify -f /tmp/entrymods
316 .fi
317 .LP
318 will replace the contents of the "Modify Me" entry's
319 .I mail
320 attribute with the value "modme@example.com", add a
321 .I title
322 of "Grand Poobah", and the contents of the file "/tmp/modme.jpeg"
323 as a
324 .IR jpegPhoto ,
325 and completely remove the
326 .I description
327 attribute.
328 .LP
329 Assuming that the file
330 .B /tmp/newentry
331 exists and has the contents:
332 .LP
333 .nf
334     dn: cn=Barbara Jensen,dc=example,dc=com
335     objectClass: person
336     cn: Barbara Jensen
337     cn: Babs Jensen
338     sn: Jensen
339     title: the world's most famous mythical manager
340     mail: bjensen@example.com
341     uid: bjensen
342 .LP
343 the command:
344 .LP
345 .nf
346     ldapadd -f /tmp/newentry
347 .fi
348 .LP
349 will add a new entry for Babs Jensen, using the values from the
350 file
351 .B /tmp/newentry.
352 .LP
353 Assuming that the file
354 .B /tmp/entrymods
355 exists and has the contents:
356 .LP
357 .nf
358     dn: cn=Barbara Jensen,dc=example,dc=com
359     changetype: delete
360 .LP
361 the command:
362 .LP
363 .nf
364     ldapmodify -f /tmp/entrymods
365 .fi
366 .LP
367 will remove Babs Jensen's entry.
368 .SH DIAGNOSTICS
369 Exit status is zero if no errors occur.  Errors result in a non-zero
370 exit status and a diagnostic message being written to standard error.
371 .SH "SEE ALSO"
372 .BR ldapadd (1),
373 .BR ldapdelete (1),
374 .BR ldapmodrdn (1),
375 .BR ldapsearch (1),
376 .BR ldap.conf (5),
377 .BR ldap (3),
378 .BR ldap_add (3),
379 .BR ldap_delete (3),
380 .BR ldap_modify (3),
381 .BR ldap_modrdn (3),
382 .BR slapd.replog (5)
383 .SH AUTHOR
384 The OpenLDAP Project <http://www.openldap.org/>
385 .SH ACKNOWLEDGEMENTS
386 .B OpenLDAP
387 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
388 .B OpenLDAP
389 is derived from University of Michigan LDAP 3.3 Release.