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