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