Oracle9i Directory Service Integration and Deployment Guide Release 2 (9.2) Part Number A96579-01 |
|
LDAP protocol operations are divided into three categories: authentication, interrogation, and update and control. The LDAP C-API provides a number of simple command-line tools that together cover all three categories.
The appendix covers the following topics:
This section introduces six popular command-line tools. The section "Optional Arguments for Command-Line Tools", immediately following, defines the optional arguments used in the command descriptions and examples.
These are the six commands:
Use the command-line tool ldapbind
to authenticate to a directory server. You can also use ldapbind
to find out if the server is running.
ldapbind
[options
]
ldapbind -h myhost -p 389 -D "cn=orcladmin" -w welcome
This command authenticates user orcladmin
to the directory server myhost
located at port 389, using the password welcome
.
Use the command-line tool ldapsearch
to search for specific entries in a directory. ldapsearch
opens a connection to a directory, authenticates the user performing the operation, searches for the specified entry, and prints the result in a format that the user specifies.
ldapsearch [
options
]
filter
[
attributes
]
ldapsearch -h myhost -p 389 -s base -b "ou=people,dc=acme,dc=com" \
"objectclass=*"
This command searches the directory server myhost
, located at port 389. The scope of the search (-s
) is base, and the part of the directory searched is the base DN (-b
) designated. The search filter "objectclass=*"
means that values for all of the entry's object classes are returned. No attributes are returned because they have not been requested. The example assumes anonymous authentication because authentication options are not specified.
Use the command-line tool ldapadd
to add entries to the directory. ldapadd
opens a connection to the directory and authenticates the user. Then it opens the LDIF file supplied as an argument and adds, in succession, each entry in the file.
ldapadd
[options
] [-fLDIF-filename
]
ldapadd -h myhost -p 389 -D "cn=orcladmin" -w welcome -f jhay.ldif
Using this command, user orcladmin
authenticates to the directory myhost
, located at port 389. The command then opens the file jhay.ldif
and adds its contents to the directory. The file might, for example, add the entry uid=jhay,cn=Human Resources,cn=acme,dc=com
and its object classes and attributes.
See Also:
"LDIF" for details about LDIF file syntax |
Use the command-line tool ldapdelete
to remove leaf entries from a directory. ldapdelete
opens a connection to a directory server and authenticates the user. Then it deletes specified entries.
ldapdelete [
options
] "
entry DN
"
ldapdelete -h myhost -p 389 -D "cn=orcladmin" -w welcome \
"uid=hricard,ou=sales,ou=people,dc=acme,dc=com"
This command authenticates user orcladmin
to the directory myhost
, using the password welcome
. Then it deletes the entry uid=hricard,ou=sales,ou=people,dc=acme,dc=com
.
Use the command-line tool ldapmodify
to modify existing entries. ldapmodify
opens a connection to the directory and authenticates the user. Then it opens the LDIF file supplied as an argument and modifies the LDAP entries specified by the file.
ldapmodify
uses a modified form of an LDIF file. Within the file itself, you use the attribute changetype
to specify the type of change. An example is changetype:
add
.
Four types of changes are possible:
add
--adds a new entrymodify
--changes an existing entry, that is, it adds, deletes, or replaces attributes of the entrydelete
--deletes an existing entrymodrdn
--modifies the RDN of an existing entryldapmodify
[options
] [-fLDIF-filename
]
ldapmodify -h myhost -p 389 -D "cn=orcladmin" -w welcome -f hricard.ldif
Using this command, user orcladmin
authenticates to the directory myhost
, located at port 389. The command then opens the file hricard.ldif
and modifies the directory entries specified by the file. The file might, for example, change the telephone number attribute of entry uid=hricard,cn=sales,cn=acme,dc=com
.
Use the command-line tool ldapmoddn
to:
ldapmoddn [
options
] -b "
current DN
" -R "
new RDN
" -N "
new Parent
"
ldapmoddn -h myhost -p 389 -D "cn=orcladmin" -w welcome \
-b "uid=oball,ou=sales,ou=people,dc=acme,dc=com" \
-N "ou=marketing,ou=people,dc=acme,dc=com"
This command authenticates user orcladmin
to the directory myhost
, using the password welcome
. Then it assigns to the entry uid=oball,ou=sales,ou=people,dc=acme,dc=com
a new parent entry, ou=marketing,ou=people,dc=acme,dc=com
.
Table B-1 defines the optional arguments used in the command descriptions and examples.
Option | Description |
---|---|
|
The host name of the directory server |
|
The port number of the directory server |
|
The bind DN--that is, the user authenticating to the directory |
|
The bind password in simple authentication |
|
Wallet location for one- or two-way SSL authentication |
|
Wallet password |
|
SSL authentication mode: |
|
The base DN for a search: |
|
Search scope: |
|
The LDIF file containing additions, deletions, or modifications |
|
New RDN |
|
New parent for an entry or subtree that is moved |
1 Mandatory for ldapsearch 2 Mandatory for ldapsearch |
See Also:
Chapter 5, "Command-Line Tools Syntax" in Oracle Internet Directory Application Developer's Guide |
|
Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|