Title: 2.1.1 - Adding Entries NavPrev: 2.1-data-modification.html NavPrevText: 2.1 - Data modification NavUp: 2.1-data-modification.html NavUpText: 2.1 - Data modification NavNext: 2.1.2-deleting-entries.html NavNextText: 2.1.2 - Deleting Entries 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.1 - Adding Entries We will see how to add new entries into the server. Assuming that we have already created a partition (see [Adding a partition](1.4.3-adding-partition.html)), we will use this added partition as a root for the entry addition. We will also create the _ou=people_ entry. We try to add a new user to the "Seven Seas" partition. The data for the entry is inspired by "Peter Pan" and provided by this LDIF file ([Captain hook](resources/captain-hook-hierarchy.ldif)): # File captain_hook.ldif dn: ou=people,o=sevenSeas objectclass: organizationalUnit objectclass: top ou: people dn: cn=James Hook,ou=people,o=sevenSeas objectclass: inetOrgPerson objectclass: organizationalPerson objectclass: person objectclass: top cn: James Hook description: A pirate captain and Peter Pan's nemesis sn: Hook mail: jhook@neverland userpassword: peterPan The first entry creates the _ou=people_ container, which is necessary otherwise we can't inject the second entry. ## Using the command line You have to use an authorized user to inject the entry, here, _cn=Horatio Nelson,ou=people,o=sevenSeas_ : $ ldapmodify -h zanzibar -p 10389 -D "cn=Horatio Nelson,ou=people,o=sevenSeas" -w pass \\ -a -f captain_hook.ldif adding new entry cn=James Hook,ou=people,o=sevenSeas $ Afterwards a new entry is successfully created within the "Seven Seas" partition by user "Horatio Nelson". The '+' sign in the attributes list of the _ldapsearch_ command causes ApacheDS to return the operational attributes, which demonstrate this. $ ldapsearch -h zanzibar -p 10389 -b "o=sevenSeas" -s sub "(cn=James Hook)" + version: 1 dn: cn=James Hook,ou=people,o=sevenSeas accessControlSubentries: cn=sevenSeasAuthorizationRequirementsACISubentry,o=sevenSeas creatorsName: cn=Horatio Nelson,ou=people,o=sevenSeas createTimestamp: 20061203140109Z ## Using Apache Directory Studio Once connected on the server with studio, you should be able to inject new entries -assuming you have the sufficent priviledge - : ![Import entry with studio](images/import-entry-studio.png) Then select the LDIF file containing the entry : ![LDIF import](images/ldif-import-file-select.png) When imported, the _log_ windows should contain this message : ::: #!RESULT OK #!CONNECTION ldap://localhost:10389 #!DATE 2012-10-30T14:36:21.294 dn: ou=people,o=sevenSeas changetype: add ou: people objectclass: organizationalUnit objectclass: top #! RESULT OK #! CONNECTION ldap://localhost:10389 #! DATE 2012-10-30T14:36:21.320 dn: cn=James Hook,ou=people,o=sevenSeas changetype: add mail: jhook@neverland userpassword: peterPan description: A pirate captain and Peter Pan's nemesis objectclass: inetOrgPerson objectclass: organizationalPerson objectclass: person objectclass: top sn: Hook cn: James Hook This is it for this basic introduction on how to add entries in the server. There are other ways, like using and LDAP API, to do the same thing.