Chapter 6. Directory Services

The larger the information system, the harder it becomes to find anything in that system or even 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 other messaging services. Resources on a network, like printers and network-available disk areas, might be advertised via a directory service. 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 ADSI.

What’s a Directory?

In Chapter 7, I suggest 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 “database” and “directory” by observing a few salient characteristics of directories:


Directories are almost always networked. Unlike some databases that live on the same machine as their clients (like 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’ll see the most common one, SQL, in the aforementioned Chapter 7, and in Appendix D. Communicating with a directory is a much simpler affair. A directory ...

Get Perl for System Administration now with the O’Reilly learning platform.

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