HP-UX Directory Server Administrator Guide HP-UX Directory Server Version 8.1 (5900-3098, May 2013)

3.2 Managing Entries from the Command line
The command line utilities allow you to manipulate the contents of your directory. They can be
useful to write scripts to perform bulk management of the directory or to test the Directory Server.
For example, you might want to ensure that it returns the expected information after you have made
changes to access control information.
With command line utilities, information can be provided directly from the command line or through
an LDIF input file.
“Providing input from the command line” (page 111)
“Creating a root entry from the command line” (page 112)
Adding entries using LDIF” (page 112)
Adding and modifying entries using ldapmodify” (page 112)
“Deleting entries using ldapdelete” (page 114)
“Using special characters” (page 115)
NOTE:
You cannot modify your directory unless the appropriate access control rules have been set. For
information on creating access control rules for the directory, see “Managing Access Control”
(page 232).
3.2.1 Providing input from the command line
When you provide input to the ldapmodify and ldapdelete utilities directly from the command
line, you must use LDIF statements. The LDAP tools are located at the /opt/dirsrv/bin directory.
For detailed information on LDIF statements, see “LDIF Update Statements” (page 120).
The ldapmodify and ldapdelete utilities read the statements that you enter in exactly the same
way as if they were read from a file. When all the input has been entered, enter the character that
the shell recognizes as the end of file (EOF) escape sequence. The utility then begins operations
based on the supplied inputs.
While the EOF escape sequence depends on the type of machine, the EOF escape sequence almost
always Ctrl-D (^D).
For example, to input some LDIF update statements to ldapmodify, you would do the following:
ldapmodify -D "cn=directory manager" -w secret -p 389 -h server.example.com
dn: cn=Barry Nixon, ou=people, dc=example,dc=com
changetype: modify
delete: telephonenumber
-
add: manager
manager: cn=Harry Cruise, ou=people, dc=example,dc=com
^D
When adding an entry from the command line or from LDIF, make sure that an entry representing
a subtree is created before new entries are created under that branch. For example, to place an
entry in a People subtree, create an entry representing that subtree before creating entries within
the subtree. For example:
dn: dc=example,dc=com
dn: ou=People, dc=example,dc=com
...People subtree entries. ...
dn: ou=Group, dc=example,dc=com
...Group subtree entries. ...
3.2 Managing Entries from the Command line 111