Mailing Lists and ‘Odd’ Files

The simplest way to create a mailing list is to edit the mail aliases file itself, located at /etc/aliases. Simply edit the file and add the list. Lists look like my-list: person1,person2,person3.

1. How do I set up a mailing list?

The simplest way to create a mailing list is to edit the mail aliases file itself, located at /etc/aliases. Simply edit the file and add the list. Lists look like my-list: person1,person2,person3.

For a small list or one that does not change often, hand-editing the alias file is a workable solution. However, for larger and more frequently changing mailing lists, a mailing list management tool is probably better. There are several popular tools available — see the sidebar “Popular Mailing List Software” for a short list — with Majordomo (http://www.greatcircle.com/majordomo) being one of the best-known.

Written in Perl, installation of Majordomo is very simple: download the source from http://www.greatcircle.com/majordomo/1.94.5/majordomo-1.94.5.tar.gz and unpack that file with tar -xzf majordomo-1.94.5.tar.gz. Next, change to the new directory that tar created, create a new user named majordomo, and then follow the steps outlined in the INSTALL file.

Once installed, setting up a Majordomo mailing list is straightforward. While Majordomo has a number of tools to create and maintain mailing lists, the nuts-and-bolts method is to again edit the file /etc/aliases directly.

For example, to create the mailing list my-friends, edit /etc/aliases file and enter the following lines:

# A mailing list for my friends . . .
my-friends: “|/opt/majordomo/wrapper resend -l my-friends my-friends”
my-friends-list: :include:/opt/majordomo/lists/my-friends
owner-my-friends: mascio
my-friends-owner: mascio
my-friends-request: “|/opt/majordomo/wrapper majordomo -l my-friends

These five lines (excluding the comment) define a new mailing list. The owner-my-friends and my-friends-owner entries specify the person that owns the list and who should be contacted for problems, respectively. The my-friends-request alias can point to a human list administrator or to Majordomo to handle requests automatically. In the latter case, the my-friends.config file controls how requests are processed.

The interesting lines are the aliases my-friends and my-friends-list. The first line is the public address used to send email to the entire alias. It invokes Majordomo to process the email. The second line refers to a file that contains the list of email addresses for the my-friends alias. Email sent to the my-friends alias gets sent to everyone listed in /opt/majordomo/lists/my-friends.

There are two other files used by Majordomo. my-friends. config is the configuration file for the mailing list. and my-friends.info is an information file describing the mailing list.

Majordomo is a powerful tool. Read the documentation to learn more about it.

2. How do I remove a file whose name has odd characters?

A popular — and vicious — trick to pull on new users is to create a file in the user’s home directory named “-rf“, or worse, “-rf *”. Then, a user naively typing rm -rf * would delete every file in the current directory.

Non-printing characters are especially tricky. For example, you may see a file name like foo?bar. The question mark indicates there is an unprintable character. If you also have files like foo1bar and fooabar, trying to remove the first file with the command rm foo?bar also deletes the other two.

You may have to use wildcards a to remove such files. When trying to remove such unusual files, use -i, which prompts you before deleting each file. In the cases here, typing rm -i * or rm -i foo?bar lets you enter “y” for the files you wish to delete, and “n” for the others.

Additionally, you can use ./ before any file names to help eliminate the danger of files with a leading dash. And you can use the “” (dash-dash) option to remove files whose names begin with a dash.

SIDEBAR ONE: Popular Mailing List Software

John R. S. Mascio is an IT consultant in the Dallas/Fort Worth area, specializing in Linux and Open Systems. He can be reached at mascio@ryu.com.

Comments are closed.