Chapter 9. Directory Services

The larger an information system gets, the harder it becomes to find anything in that system, or even to know what’s available. As networks grow and become more complex, they are well served by some sort of directory. Network users might make use of a directory service to find other users for email and messaging services. A directory service might advertise resources on a network, such as printers and network-available disk areas. Public-key and certificate infrastructures could use a directory service to distribute information. In this chapter we’ll look at how to use Perl to interact with some of the more popular directory services, including Finger, WHOIS, LDAP, and Active Directory (via Active Directory Service Interfaces).

What’s a Directory?

In Chapter 7, I suggested that all the system administration world is a database. Directories are a good example of this characterization. For the purpose of our discussion, we’ll distinguish between “databases” and “directories” by observing a few salient characteristics of directories:


Directories are almost always networked. Unlike a database, which may live on the same machine as its clients (e.g., the venerable /etc/passwd file), directory services are usually provided over a network.

Simple communication/data manipulation

Databases often have complex query languages for data queries and manipulation. We looked at the most common of these, SQL, in Chapter 7 (and in Appendix D). Communicating with ...

Get Automating System Administration with Perl, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.