Securing and Optimizing Linux: RedHat Edition -A Hands on Guide | ||
---|---|---|
Prev | Chapter 26. Linux OpenLDAP Server | Next |
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:
cn=Europe Mourani, o=openna, c=com cn=Europe Mourani sn=Mourani [email protected] description=Marketing relation objectClass=person |
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 : |
: It is important to note that the slapd daemon of LDAP is started in this mode of creation.
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:
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. |
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 |