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