| < Day Day Up > |
|
We have been typing commands using the command-line tool. This has two drawbacks: the risk of typos and the lack of documentation showing what you typed in. Fortunately, the ldapmodify command also accepts a file as input. Exhibit 9 shows what this file looks like. You will recognize the same input as you gave at the command line. Exhibit 10 shows the messages confirming execution of the file in Exhibit 9.
# cat Persons.ldif dn: uid=TKlein, ou=Mkt, o=ldap_abc.de objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Thomas Klein sn: Klein givenName: Thomas ou: Mkt uid: TKlein mail: ThomasKlein@ldap_abc.de dn: uid=PSmith, ou=Mkt, o=ldap_abc.de objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Peter Smith sn: Smith givenName: Peter ou: Mkt uid: PSmith mail: PeterSmith@ldap_abc.de
ldapmodify -a -D "uid=admin, o=ldap_abc.de" -w "pass1" -f Persons.ldif adding new entry "uid=TKlein, ou=Mkt, o=ldap_abc.de" adding new entry "uid=PSmith, ou=Mkt, o=ldap_abc.de"
Until now, we have used ldapmodify only in an interactive mode. Now that we know how to insert the data and instructions from a file, there is no need to use a command line to communicate with ldapmodify. Use Control-C to stop reading input from the prompt.
So far, we have learned that the directory is made up of a hierarchical tree of objects. We have seen that the position of a single object is given by its distinguished name (DN), which must he unique inside the directory. We have also seen that the distinguished name is constructed from the distinguished name of its ancestor plus its own relative distinguished name (RDN). Further, we have learned how to add entries and how to search in the directory. Finally, we have seen that instead of manually typing command-line entries, we can instruct ldapmodify to take its input from a file instead of from the command line. In the next section, we will see that ldapmodify has other functions beyond adding entries.
| < Day Day Up > |
|