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