A directory service is an application or set of applications that stores information about users and resources (like computers). Active Directory and LDAP are both examples of directory service applications.
Mac OS X 10.4 (client and server) is configured to connect to a directory service via the application "/Applications/Utilities/Directory Access.app" (other versions of OS X may name the application differently). By default Mac OS X is runs a local directory service that is configured in the System Preferences Accounts pane on OS X client and in Workgroup Manager on OS X Server.
The dscl utility allows a user to inspect and modify a directory.
This article will show how to connect to a directory service using Directory Access and how to inspect and modify the data in the directory using dscl.
To leave interactive mode, just type "quit".
Above, I showed working with the NetInfo node. That node is located on the local machine.
It is also possible to work with a network directory. Here are some shapshots showing how to connect to a network directory, specifically Mac OS X Server running Open Directory (OpenLDAP).
Select LDAPv3 and click "Configure".
Add a server, name it something useful, set the server dns name or ip.
Set the LDAP Mapping to "Open Directory Server".
Set the search base (see below to find out where this comes from).
Where did the search base come from? This is a snapshot of the Server Admin application when it connected to a Mac OS X Server. The search base is often the dns name of the server, but it really doesn't matter what it is, except that it must be the same on the clients as on the server or else nothing works!
So far I have shown interactive mode only. To convert from an interactive command to a shell prompt command, you must put the location of the datasource.
Notice how "." defaults to /Netinfo.
dscl localhost create /NetInfo/Users/new_user RealName "New User"
There are many other ds* commands in /usr/bin and /usr/sbin. Check them out!
If you ever have to work with a directory service, dscl is da bomb. Learn to use it!