 |
» |
|
|
 |
|  |  |
Using CDS Server Script Options |  |
Log in as the root user to execute the script commands. Starting the CDS Server To start the CDS server and verify the daemon is running, enter
the following commands: # /etc/init.d/cdsserver
start # ps –ef |
grep slapd Stopping the CDS ServerTo stop the CDS server and verify the daemon has stopped running,
enter the following commands: # /etc/init.d/cdsserver
stop # ps –ef |
grep slapd Restarting the CDS ServerTo restart the CDS server and verify the daemon is running,
enter the following commands: # /etc/init.d/cdsserver
restart # ps –ef |
grep slapd Checking the Status of the CDS ServerTo check the CDS server status, enter the following command: # /etc/init.d/cdsserver
status Debugging the CDS Server |  |
To print the log of the CDS server to a single file, use the
following steps: Edit the /etc/syslog.conf file
by adding the following line: local4.* /var/log/ldap.log |
Restart the syslog daemon by entering: # /etc/init.d/syslog restart Edit the file /opt/symas/etc/openldap/slapd.conf and add the appropriate log level. The OpenLDAP Web
site provides the following log level descriptions which can be used
to determine which log level is appropriate, for example, log level
8. Debugging Levels
Level Description
-1 enable all debugging
0 no debugging
1 trace function calls
2 debug packet handling
4 heavy trace debugging
8 connection management
16 print out packets sent and received
32 search filter processing
64 configuration file processing
128 access control list processing
256 stats log connections/operations/results
512 stats log entries sent
1024 print communication with shell backends
2048 print entry parsing debugging
16384 syncrepl consumer processing
|
Restart the CDS server by entering the following command: # /etc/init.d/cdsserver
restart Retrieve the basic information for function calls
in the file /var/log/ldap.log
Performing Common CDS Server Operations |  |
This section describes some common operations of CDS clients.  |  |  |  |  | NOTE: For the steps that follow, when you are prompted for a password,
enter the password specified in the slapd.conf file. The default password is secret. Assume
that the value of the suffix Directive in slapd.conf is "dc=example,dc=com". |  |  |  |  |
Adding an Entry to the DirectoryUse a text editor to create an LDIF file and save
it as /tmp/add.ldif, with the following content: dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: example
dn: dc=osm,dc=example,dc=com
objectClass: dcObject
objectClass: organizationalUnit
dc: osm
ou: osm
dn: uid=tomy,dc=osm,dc=example,dc=com
objectClass: inetOrgPerson
uid: tomy
sn: tom
cn: tom yan
mail: tom.yan@example.com
carLicense: sea4321
userPassword: tom |
 |  |  |  |  | NOTE: If there are any trailing spaces in the LDIF file, the ldapadd command fails. |  |  |  |  |
Enter the following command to add the entry to the
directory: # /opt/symas/bin/ldapadd –x –D “cn=Manager,dc=example,dc=com”\ –W –f /tmp/add.ldif
 |  |  |  |  | NOTE: For the commands listed in this and proceeding sections, the
following options are used: -D specifies the Distinguished Name (DN)
that is bound to the LDAP directory. -x specifies simple authentication. -W specifies a prompt for the bind password
(for simple authentication). -f specifies read operations from a file. -b specifies the base DN as the starting
point for the search. -s specifies the scope of the search.
The search can be base, one or sub to specify a base object, or one-level
or a subtree search. For additional information, see the ldap man
page. |  |  |  |  |
Searching for an Entry in the DirectoryTo search for the new entry you added in the previous step,
use the ldapsearch command as follows: # /opt/symas/bin/ldapsearch
-x -D "cn=Manager,dc=example,dc=com" –W \ "cn=tom yan" Modifying an Entry in the DirectoryUse a text editor to create an LDIF file, saved as /tmp/modify.ldif, with the following content: dn: uid=tomy,dc=osm,dc=example,dc=com
changetype: modify
replace: mail
mail: newmail@example.com
-
add: title
title: added title
-
delete: carLicense |
Enter the following command: # /opt/symas/bin/ldapmodify -x -D "cn=Manager,dc=example,dc=com"
\ -W -f /tmp/modify.ldif To verify the modification, use the ldapsearch command by entering the following: # /opt/symas/bin/ldapsearch -x -D "cn=Manager,dc=example,dc=com"
\ -W "cn=tom yan"
Deleting an Entry from the DirectoryTo delete one or more entries in the directory, run
the ldapdelete command as follows: # /opt/symas/bin/ldapdelete
-x -D "cn=Manager,dc=example,dc=com" \ -W "uid=tomy,dc=osm,dc=example,dc=com" To verify the deletion, enter the following command: # /opt/symas/bin/ldapsearch
-x -D "cn=Manager,dc=example,dc=com" \ -W "uid=tomy"
Modifying the Relative Distinguished Name for an Entry
in the DirectoryTo modify the Relative Distinguished Name (RDN) for
an entry, run the ldapmodrdn command as follows: # /opt/symas/bin/ldapmodrdn
-x -D "cn=Manager,dc=example,dc=com" \ -W "uid=tomy,dc=osm,dc=example,dc=com" "uid=tomy-modified" To verify the modification, use the ldapsearch command by entering the following: # /opt/symas/bin/ldapsearch -x -D "cn=Manager,dc=example,dc=com"
\ -W "cn=tom yan"
|