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