FIGURE 24.2 Thunderbird's options are buried deeper than Evolution's, but it allows you to download the LDAP directory for offline use.
Now, click Write to create a new email message, and type the first few letters of a user in the To box. If everything works, Thunderbird should pop up a box with LDAP matches.
After your LDAP server and clients are set up, they require little maintenance until some thing changes externally. Specifically, if someone in your directory changes jobs, changes her phone number, gets married (changing her surname), quits, or so forth, you need to be able to update your directory to reflect the change.
OpenLDAP comes with a selection of tools for manipulating directories, of which you have already met ldapadd
. To add to that, you can use ldapdelete
for deleting entries in your directory and ldapmodify
for modifying entries. Both are hard to use but come with moderate amounts of documentation in their man
pages.
A much smarter option is to use phpLDAPadmin
, which is a GPL LDAP administration tool that allows you to add and modify entries entirely through your web browser. You can learn more and download the product to try at http://www.phpldapadmin.com/.
► http://www.openldap.org/— The home page of the OpenLDAP project, where you can download the latest version of the software and meet other users.
► http://www.kingsmountain.com/ldapRoadmap.shtml— A great set of links and resources across the Internet that explain various aspects of LDAP and its parent protocol, X500.
► http://ldap.perl.org/— The home of the Perl library for interacting with LDAP provides comprehensive documentation to get you started.
► http://www.ldapguru.com/— A gigantic portal for LDAP administrators around the world. From forums dedicated to LDAP to jobs specifically for LDAP admins, this site could very well be all you need.
► The definitive book on LDAP is LDAP System Administration (O'Reilly), ISBN: 1-56592-491-6. It is an absolute must for the bookshelf of any Linux LDAP administrator.
► For more general reading, try LDAP Directories Explained (Addison-Wesley), ISBN: 0-201-78792-X. It has a much stronger focus on Microsoft's Active Directory LDAP implementation, though.
Perl (Practical Extraction and Report Language or Pathologically Eclectic Rubbish Lister, depending on who you speak to!) is a powerful scripting tool you can use to manage files, create reports, edit text, and perform many other tasks when using Linux. Perl is included with Fedora and could be considered an integral part of the distribution because Fedora depends on Perl for many types of software services, logging activities, and software tools. If you do a full install from this book's DVD, you will find nearly 150 software tools written in Perl installed under the /usr/bin
and /usr/sbin
directories.
Perl is not the easiest of programming languages to learn because it is designed for flexibility. This chapter shows how to create and use Perl scripts on your system. You will see what a Perl program looks like, how the language is structured, as well as where you can find modules of prewritten code to help you write your own Perl scripts.
Although originally designed as a data extraction and report generation language, Perl appeals to many Linux system administrators because it can be used to create utilities that fill a gap between the capabilities of shell scripts and compiled C programs. Another advantage of Perl over other Unix tools is that it can process and extract data from binary files, whereas sed
and awk
cannot.
NOTE
In Perl, "there is more than one way to do it." This is the unofficial motto of Perl, and it comes up so often that it is usually abbreviated as TIMTOWTDI.
You can use Perl at your shell's command line to execute one-line Perl programs, but most often the programs (usually ending in .pl
) are run as commands. These programs generally work on any computer platform because Perl has been ported to just about every operating system. Perl is available by default when you install Fedora, and you will find its RPM files on the DVD included with this book.
Perl programs are used to support a number of Fedora services, such as system logging. For example, the logwatch.pl
program is run every morning at 4:20 a.m. by the crond
(scheduling) daemon on your system. Other Fedora services supported by Perl include:
► Amanda for local and network backups
► Fax spooling with the faxrunqd
program
► Printing supported by Perl document filtering programs
► Hardware sensor monitoring setup that uses the sensors-detect
Perl program
As of this writing, the current production version of Perl is 5.8.8 (which is Perl version 5 point 8, patch level 8). You can download the code from http://www.perl.com/ and build it yourself from source. You will occasionally find updated versions in RPM format for Fedora, which you can install by updating your system.
You can determine what version of Perl you installed by typing perl -v
at a shell prompt. If you are installing the latest Fedora distribution, you should have the latest version of Perl.
This section introduces a very simple sample Perl program to get you started using Perl. Although trivial for experienced Perl hackers, a short example is necessary for new users who want to learn more about Perl.
To introduce you to the absolute basics of Perl programming, Listing 25.1 illustrates a simple Perl program that prints a short message.
LISTING 25.1 A Simple Perl Program
#!/usr/bin/perl
print "Look at all the camels!\n";
Type that in and save it to a file called trivial.pl
. Then make the file executable using the chmod
command (see the following sidebar) and run it at the command prompt.
Command-Line Error
If you get the message bash: trivial.pl: command not found
or bash: ./trivial.pl: Permission denied
, it means that you either typed the command line incorrectly or forgot to make trivial.pl
executable (with the chmod
command):
$ chmod +x trivial.pl
You can force the command to execute in the current directory as follows:
$ ./trivial.pl
Or you can use Perl to run the program like this:
$ perl trivial.pl
The sample program in the listing is a two-line Perl program. Typing in the program and running it (using Perl or making the program executable) shows how to create your first Perl program, a process duplicated by Linux users around the world every day!
NOTE
#!
is often pronounced she-bang, which is short for sharp (the musicians name for the #
character), and bang , which is another name for the exclamation point. This notation is also used in shell scripts. Refer to Chapter 33, "Writing and Executing a Shell Script," for more information about writing shell scripts.
Читать дальше