HP-UX Directory Server 8.1 administrator guide

CAUTION:
The server deletes the entry or entries immediately. There is no way to undo the delete operation.
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”
“Creating a root entry from the command line”
Adding entries using LDIF”
Adding and modifying entries using ldapmodify”
“Deleting entries using ldapdelete”
“Using special characters”
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 Chapter 6 “Managing access
control”.
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”.
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. ...
114 Creating directory entries