]> git.sur5r.net Git - openldap/blob - doc/man/man1/ldapmodify.1
74fe4acbd2ff882c2ace30acb03322b5a32ff844
[openldap] / doc / man / man1 / ldapmodify.1
1 .TH LDAPMODIFY 1 "17 August 1999" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-1999 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 \-r ]
17 [\c
18 .BR \-n ]
19 [\c
20 .BR \-v ]
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 \-h \ ldaphost\fR]
35 [\c
36 .BI \-p \ ldapport\fR]
37 [\c
38 .BI \-P \ 2\fR\||\|\fI3\fR]
39 [\c
40 .BI \-f \ file\fR]
41 .LP
42 .B ldapadd
43 [\c
44 .BR \-b ]
45 [\c
46 .BR \-c ]
47 [\c
48 .BR \-r ]
49 [\c
50 .BR \-n ]
51 [\c
52 .BR \-v ]
53 [\c
54 .BR \-k ]
55 [\c
56 .BR \-K ]
57 [\c
58 .BI \-d \ debuglevel\fR]
59 [\c
60 .BI \-D \ binddn\fR]
61 [\c
62 .BI \-w \ passwd\fR]
63 [\c
64 .BI \-h \ ldaphost\fR]
65 [\c
66 .BI \-p \ ldapport\fR]
67 [\c
68 .BI \-f \ file\fR]
69 .SH DESCRIPTION
70 .B ldapmodify
71 is a shell-accessible interface to the
72 .BR ldap_modify (3)
73 and
74 .BR ldap_add (3)
75 library calls.
76 .B ldapadd
77 is implemented as a hard link to the ldapmodify tool.  When invoked as
78 .B ldapadd
79 the -a (add new entry) flag is turned on automatically.
80 .LP
81 .B ldapmodify
82 opens a connection to an LDAP server, binds, and modifies or adds entries.
83 The entry information is read from standard input or from \fIfile\fP through
84 the use of the -f option.
85 .SH OPTIONS
86 .TP
87 .B \-a
88 Add new entries.  The default for
89 .B ldapmodify
90 is to modify existing entries.  If invoked as
91 .BR ldapadd ,
92 this flag is always set.
93 .TP
94 .B \-b
95 Assume that any values that start with a `/' are binary values and that
96 the actual value is in a file whose path is specified in the place where
97 values normally appear.
98 .TP
99 .B \-c
100 Continuous operation mode.  Errors are reported, but
101 .B ldapmodify
102 will continue with modifications.  The default is to exit after
103 reporting an error.
104 .TP
105 .B \-r
106 Replace existing values by default.
107 .TP
108 .B \-n
109 Show what would be done, but don't actually modify entries.  Useful for
110 debugging in conjunction with -v.
111 .TP
112 .B \-v
113 Use verbose mode, with many diagnostics written to standard output.
114 .TP
115 .B \-k
116 Use Kerberos authentication instead of simple authentication.  It is
117 assumed that you already have a valid ticket granting ticket.  You must
118 compile with KERBEROS defined for this option to have any effect.
119 .TP
120 .B \-K
121 Same as \-k, but only does step 1 of the kerberos bind.  This is useful
122 when connecting to a slapd and there is no x500dsa.hostname principal
123 registered with your kerberos servers.
124 .TP
125 .B \-F
126 Force application of all changes regardless of the contents of input
127 lines that begin with
128 .I replica:
129 (by default, replica: lines are compared against the LDAP server host
130 and port in use to decide if a replog record should actually be applied).
131 .TP
132 .B \-M[M]
133 Enable manage DSA IT control.
134 .B \-MM
135 makes control critical.
136 .TP
137 .BI \-d \ debuglevel
138 Set the LDAP debugging level to \fIdebuglevel\fP.
139 .B ldapmodify
140 must be compiled with LDAP_DEBUG defined for this option to have any effect.
141 .TP
142 .BI \-f \ file
143 Read the entry modification information from \fIfile\fP instead of from
144 standard input.
145 .TP
146 .BI \-D \ binddn
147 Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
148 a string-represented DN as defined in RFC 1779.
149 .TP
150 .B \-W
151 Prompt for simple authentication.
152 This is used instead of specifying the password on the command line.
153 .TP
154 .BI \-w \ passwd
155 Use \fIpasswd\fP as the password for simple authentication.
156 .TP
157 .BI \-h \ ldaphost
158 Specify an alternate host on which the ldap server is running.
159 .TP
160 .BI \-p \ ldapport
161 Specify an alternate TCP port where the ldap server is listening.
162 .TP
163 .BI \-P \ 2\fR\||\|\fI3
164 Specify the LDAP protocol version to use.
165 .SH INPUT FORMAT
166 The contents of \fIfile\fP (or standard input if no \-f flag is given on
167 the command line) should conform to the format defined in
168 .BR slapd.replog (5),
169 with the exceptions noted below.
170 .LP
171 If the first line of a record consists of a decimal number (entry id),
172 it is ignored.
173 .LP
174 Lines that begin with "replica:" are matched against the LDAP server host
175 and port in use to decide if a particular replog record should be applied.
176 Any other lines that precede the "dn:" line are ignored.
177 The -F flag can be used to force
178 .I ldapmodify
179 to apply all of the replog changes, regardless of the presence or
180 absence of any "replica:" lines.
181 .LP
182 If no "changetype:" line is present, the default is "add" if the -a
183 flag is set (or if the program was invoked as
184 .I ldapmodify)
185 and "modify" otherwise.
186 .LP
187 If changetype is "modify" and no "add:", "replace:", or "delete:" lines
188 appear, the default is "replace" if the -r flag is set and "add"
189 otherwise.
190 .LP
191 Note that the above exceptions to the
192 .BR slapd.replog (5)
193 format allow
194 .BR ldif (5)
195 entries to be used as input to
196 .I ldapmodify
197 or
198 .I ldapadd.
199 .SH ALTERNATIVE INPUT FORMAT
200 An alternative input format is supported for compatibility with older
201 versions of
202 .I ldapmodify.
203 This format consists of one or more entries separated by blank lines,
204 where each entry looks like:
205 .LP
206 .nf
207     Distinguished Name (DN)
208     attr=value
209     [attr=value ...]
210 .fi
211 .LP
212 where \fIattr\fP is the name of the attribute and \fIvalue\fP is the
213 value.
214 .LP
215 By default, values are added.  If the
216 .RI \- r
217 command line flag is
218 given, the default is to replace existing values with the new one.
219 Note that it is permissible for a given attribute to appear more than
220 once (for example, to add more than one value for an attribute).  Also
221 note that you can use a trailing `\\' to continue values across lines and
222 preserve newlines in the value itself (this is useful for modifying
223 QUIPU iattr attributes among others).
224 .LP
225 .I attr
226 should be preceded by a \fB-\fP to remove a value.  The `=' and
227 value should be omitted to remove an entire attribute.
228 .LP
229 .I attr
230 should be preceded by a \fB+\fP to add a value in the presence of the
231 \-r flag.
232 .LP
233 .SH EXAMPLES
234 Assuming that the file
235 .B /tmp/entrymods
236 exists and has the contents:
237 .LP
238 .nf
239     dn: cn=Modify Me, dc=OpenLDAP, dc=Org
240     changetype: modify
241     replace: mail
242     mail: modme@OpenLDAP.org
243     -
244     add: title
245     title: Grand Poobah
246     -
247     add: jpegPhoto
248     jpegPhoto:< file://tmp/modme.jpeg
249     -
250     delete: description
251     -
252 .fi
253 .LP
254 the command:
255 .LP
256 .nf
257     ldapmodify -b -r -f /tmp/entrymods
258 .fi
259 .LP
260 will replace the contents of the "Modify Me" entry's
261 .I mail
262 attribute with the value "modme@OpenLDAP.org", add a
263 .I title
264 of "Grand Poobah", and the contents of the file "/tmp/modme.jpeg"
265 as a
266 .IR jpegPhoto ,
267 and completely remove the
268 .I description
269 attribute.
270 The same modifications as above can be performed using the older
271 .I ldapmodify
272 inout format:
273 .LP
274 .nf
275     cn=Modify Me, dc=OpenLDAP, dc=org
276     mail=modme@OpenLDAP.org
277     +title=Grand Poobah
278     +jpegPhoto=/tmp/modme.jpeg
279     -description
280 .fi
281 .LP
282 and the command:
283 .LP
284 .nf
285     ldapmodify -b -r -f /tmp/entrymods
286 .fi
287 .LP
288 Assuming that the file
289 .B /tmp/newentry
290 exists and has the contents:
291 .LP
292 .nf
293     dn: cn=Barbara Jensen, dc=OpenLDAP, dc=org 
294     objectClass: person
295     cn: Barbara Jensen
296     cn: Babs Jensen
297     sn: Jensen
298     title: the world's most famous mythical manager
299     mail: bjensen@OpenLDAP.org
300     uid: bjensen
301 .LP
302 the command:
303 .LP
304 .nf
305     ldapadd -f /tmp/entrymods
306 .fi
307 .LP
308 will add a new entry for Babs Jensen, using the values from the
309 file
310 .B /tmp/newentry.
311 .LP
312 Assuming that the file
313 .B /tmp/newentry
314 exists and has the contents:
315 .LP
316 .nf
317     dn: cn=Barbara Jensen, dc=OpenLDAP, dc=org
318     changetype: delete
319 .LP
320 the command:
321 .LP
322 .nf
323     ldapmodify -f /tmp/entrymods
324 .fi
325 .LP
326 will remove Babs Jensen's entry.
327 .SH DIAGNOSTICS
328 Exit status is 0 if no errors occur.  Errors result in a non-zero exit
329 status and a diagnostic message being written to standard error.
330 .SH "SEE ALSO"
331 .BR ldapadd (1),
332 .BR ldapdelete (1),
333 .BR ldapmodrdn (1),
334 .BR ldapsearch (1),
335 .BR ldap.conf (5),
336 .BR ldap (3),
337 .BR ldap_add (3),
338 .BR ldap_delete (3),
339 .BR ldap_modify (3),
340 .BR ldap_modrdn (3),
341 .BR slapd.replog (5)
342 .LP
343 Kille, S.,
344 .IR "A String Representation of Distinguished Names",
345 .SM RFC
346 1779,
347 ISODE Consortium, March 1995.
348 .SH BUGS
349 There is no interactive mode, but there probably should be.
350 .SH ACKNOWLEDGEMENTS
351 .B      OpenLDAP
352 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
353 .B      OpenLDAP
354 is derived from University of Michigan LDAP 3.3 Release.