blob: 143fa297ef78e7fa37afdf491edec0e7212993e2 [file] [log] [blame]
Title: 2.1.2 - Deleting Entries
NavPrev: 2.1.1-adding-entries.html
NavPrevText: 2.1.1 - Adding Entries
NavUp: 2.1-data-modification.html
NavUpText: 2.1 - Data modification
NavNext: 2.2-searching-data.html
NavNextText: 2.2 - Searching Data
Notice: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# 2.1.2 - Deleting Entries
Deleting entries is quite simple : you just need to provide their _DN_, and require for the deletion of the associated entry. Although there are a few conditions that must be fulfilled for this operatio to be successful :
* The entry must exist;
* It should not have any children;
* The user requiring the deletion must have enough priviledge to do so
Assuming those three conditions being fulfilled, you can proceed with the deletion. We will show how it works on the entry we added in the previous chapter.
## Using the command line
You have to use an authorized user to delete the entry, here, _cn=Horatio Nelson,ou=people,o=sevenSeas_ :
With an LDIF file ([Captain hook delete](resources/captain-hook-delete.ldif)) with an appropriate change entry, this can easily be accomplished, if the bind user is allowed to do so. Here is the content of this _LDIF_ file :
# File captain_hook_delete.ldif
dn: cn=James Hook,ou=people,o=sevenSeas
changetype: delete
and here is the command line to use :
$ ldapdel -h zanzibar -p 10389 -D "cn=Horatio Nelson,ou=people,o=sevenSeas" -w pass \\
-a -f captain_hook.ldif
deleting entry cn=James Hook,ou=people,o=sevenSeas
$
## Using Apache Directory Studio
With studio, just select the entry you want to delete, and select the "Delete" menu :
![Delete entry with studio](images/delete-entry.png)
When deleteed, the _log_ windows should contain this message :
:::
#!RESULT OK
#!CONNECTION ldap://localhost:10389
#!DATE 2012-10-30T14:57:47.399
dn: cn=James Hook,ou=people,o=SevenSeans
changetype: delete
Studio allows you to delete entries which have children, but it will first try to delete all the children recursively. There is no such things when you send an LDAP _DeleteRequest_.