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