26.8. Create the LDMB backend database on-line

If the entries in your directory server are already created or if you have only a small amount of information to insert into your backend database, you'll prefer to use the ldapadd command utility to do your job on-line. For example, to add the Europe Mourani entry using the ldapadd tool, you could create a file called newentry in your /tmp directory.

Example 26-2. LDMB backend

Create the newentry file, touch /tmp/newentry and add in this file the following contents:

  1. 
                       cn=Europe Mourani, o=openna, c=com
                           cn=Europe Mourani
                           sn=Mourani
                           [email protected]
                           description=Marketing relation
                           objectClass=person
                         

  2. Once the file newentry has been created, we must add the entry into the LDAP directory server. To actually create the entry on-line in the backend database, use the following command:
    
                       [root@deep] /# ldapadd -f  /tmp/newentry -D "cn=admin, o=openna, c=com" -W
                         
    
                       Enter LDAP Password :
                         
    The above command assumes that you have set rootdn to cn=admin, o=openna, c=com and rootpw to secret. You will be prompted to enter the password.

Important: It is important to note that the slapd daemon of LDAP is started in this mode of creation.

26.8.1. ldapmodify

Contrary to relational databases where data is constantly changed, the directory server contains information that is rarely modified once inserted. But, some times you need to modify information, and the ldapmodify tool will help you in your tasks. The ldapmodify command allows you to add or modify entries on the backend directory server.

Example 26-3. modifyentry

Assuming that we want to replace the contents of the Europe Mourani entry's mail attribute with the new value [email protected], the following steps will be require:

  1. Create the modifyentry file, touch /tmp/modifyentry and add in this file the contents:
    
                       cn=Europe Mourani, o=openna, c=com
                           - [email protected]		# will delete the old mail address for Europe Mourani in the database.
                           [email protected]	        # will add the new mail address for Europe Mourani in the database.
                         

  2. Once the modifyentry file has been created, we must replace the entry in the LDAP directory server with the one contained in this file -modifyentry. To modify the contents of backend database, use the following command:
    
                       [root@deep] /# ladpmodify -D cn=Admin, o=openna, c=com -W  -f <inputfile>
                           [root@deep] /# ladpmodify -D cn=Admin, o=openna, c=com -W  -f modifyentry
                         
    Where <inputfile> is the name of the file modifyentry we created in step 1 above.