Managing Mail and News Servers - The Internet - Linux All-in-One For Dummies, 5th Edition (2014)

Linux All-in-One For Dummies, 5th Edition (2014)

Book IV. The Internet

Chapter 5. Managing Mail and News Servers

In This Chapter

arrow Installing and using sendmail

arrow Testing mail delivery manually

arrow Configuring sendmail

arrow Installing the InterNetNews (INN) server

arrow Configuring and starting INN

arrow Setting up local newsgroups

Electronic mail (e-mail) is one of the popular services available on Internet hosts. E-mail software comes in two parts: a mail transport agent (MTA), which physically sends and receives mail messages, and a mail user agent (MUA), which reads messages and prepares new messages. This chapter describes the e-mail service and shows you how to configure the sendmail server on a Linux PC.

Internet newsgroups provide another convenient way, besides e-mail, to discuss various topics and share your knowledge with others. Linux comes with the software you need to read newsgroups and set up your own system as a news server. This chapter also describes how to configure and run the popular InterNetNews server and shows how to set up local newsgroups for your corporate intranet (or even your home network).

Installing the Mail Server

Depending on the choices you made during Linux installation, you may have already installed the mail server software on your system. You can choose from several mail servers, such as exim, postfix, and sendmail — sendmail is briefly covered in this chapter. If sendmail is not installed, you can easily install it.

Using sendmail

To set up your system as a mail server, you must configure the sendmail mail transport agent properly. sendmail has the reputation of being a complex but complete mail-delivery system. Just one look at sendmail’s configuration file — /etc/mail/ in Fedora or/etc/ in SUSE — can convince you that sendmail is indeed complex. Luckily, you don’t have to be an expert on the sendmail configuration file. All you need is one of the predefined configuration files — such as the one installed on your system — to usesendmail.

Your system already has a working sendmail configuration file — /etc/mail/ The default file assumes you have an Internet connection and a name server. Provided that you have an Internet connection and that your system has an official domain name, you can send and receive e-mail from your Linux PC.

technicalstuff.eps To ensure that mail delivery works correctly, your system’s name must match the system name that your ISP has assigned to you. Although you can give your system any hostname you want, other systems can successfully deliver mail to your system only if your system’s name is in the ISP’s name server.

A mail-delivery test

To try the sendmail mail transfer agent, you can use the mail command to compose and send a mail message to any user account on your Linux system. As a test, compose a message and send it to yourself. For example, here’s how to send a message using the mail command. (Input appears in boldface.)

mail edulaney
Subject: Testing e-mail
This is from my Linux system.

The mail command is a simple mail user agent. In the preceding example, the addressee (edulaney) is specified in the command line. The mail program prompts for a subject line. Following the subject, enter the message and end it with a line that contains only a period. You will be prompted for a Cc:, but leave that blank. After ending the message, the mail user agent passes the message to sendmail (the mail transport agent) for delivery to the specified address. sendmail delivers the mail message immediately. To verify the delivery of mail, type mail to run the mail command again and read the message.

If any of your mail server software is not properly installed, you should be prompted during this test to install any needed components and resolve the problem.

Thus the initial sendmail configuration file is adequate for sending and receiving e-mail, at least within your Linux system. External mail delivery also works, provided that your Linux system has an Internet connection and a registered domain name.

remember.eps If you have an ISP account that provides your Linux system with a dynamic IP address, you have to use a mail client such as Evolution or Mozilla Mail, which contacts your ISP’s mail server to deliver outbound e-mail.

The mail-delivery mechanism

On an Internet host, the sendmail mail transport agent delivers mail using the Simple Mail Transfer Protocol (SMTP). SMTP-based mail transport agents listen to TCP port 25 and use a small set of text commands to exchange information with other mail transport agents. SMTP commands are simple enough that you can use them manually from a terminal to send a mail message. The telnet command opens a TELNET session to port 25 (the port on which sendmail expects SMTP commands). The sendmail process on the Linux system immediately replies with an announcement.

You can type HELP to view a list of SMTP commands. To get help on a specific command, type HELP commandname. Type HELO localhost to initiate a session with the host. The sendmail process replies with a greeting. To send the mail message, start with the MAIL FROM:command, which specifies the sender of the message. Next, use the RCPT TO: command to specify the recipient of the message. If you want to send the message to several recipients, provide each recipient’s address with the RCPT TO: command.

To enter the mail message, use the DATA command. In response to the DATA command, sendmail displays an instruction that you have to end the message with a period on a line by itself. After you do so and end the message, the sendmail process displays a message indicating that the message is accepted for delivery. You can then quit the sendmail session with the QUIT command.

The sendmail configuration file

You don’t have to understand everything in the sendmail configuration file,, but you need to know how that file is created. That way, you can make minor changes if necessary and regenerate the file.

 width= In SUSE, you can configure sendmail through the YaST Control Center — choose System⇒Control Center (YaST) from the main menu. Click Network Services in the left side of the window, and then click Mail Transfer Agent in the right side of the window. YaST displays a window that you can use to configure sendmail. First you specify the general settings, then the settings for outgoing mail, and finally the settings for incoming mail. After you exit the mail configuration utility, YaST stores the mail settings in the files/etc/sysconfig/sendmail and /etc/sysconfig/mail and then runs SuSEconfig to update the sendmail configuration file (/etc/

You can also generate the file from a number of m4 macro files (text files in which each line eventually expands to multiple lines that mean something to some program). These macro files are organized into a number ofsubdirectories in the /usr/share/sendmail-cf directory in Fedora or the /usr/share/sendmail directory in SUSE. You can read the README file in that directory to find out more about the creation of sendmail configuration files.

The m4 macro processor

The m4 macro processor generates the configuration file, which comes with the sendmail package in Linux. The main macro file, named,, or, is included with the sendmail package.

technicalstuff.eps So what’s a macro? A macro is basically a symbolic name for code that handles some action, usually in a shorthand form that substitutes for a long string of characters. A macro processor such as m4 usually reads its input file and copies it to the output, processing the macros along the way. The processing of a macro generally involves performing some action and generating some output. Because a macro generates a lot more text in the output than merely the macro’s name, the processing of macros is referred to as macro expansion.

The m4 macro processor is stream-based. That means it copies the input characters to the output while it’s busy expanding any macros. The m4 macro processor does not have any concept of lines, so it copies newline characters (that mark the end of a line) to the output. That’s why in most m4 macro files you see dnl, an m4 macro that stands for delete through newline. The dnl macro deletes all characters starting at the dnl up to and including the next newline character. The newline characters in the output don’t cause any harm; they merely create unnecessary blank lines. The sendmail macro package uses dnl to avoid such blank lines in the output configuration file. Because dnl basically means delete everything up to the end of the line, m4 macro files also use dnl as the prefix for comment lines.

To see a simple use of m4, consider the following m4 macro file, which defines two macros — hello and bye — and uses them in a form letter:

dnl ###################################################
dnl # File: ex.m4
dnl # A simple example of m4 macros
dnl ###################################################
define('hello', 'Dear Sir/Madam')dnl
Customer Service')dnl
dnl Now type the letter and use the macros
This is to inform you that we received your recent inquiry.
We will respond to your question soon.

Type this text (using your favorite text editor) and save it in a file named ex.m4. You can name a macro file anything you like, but using the .m4 extension for m4 macro files is customary.

Before you process the macro file by using m4, note the following key points about the example:

· Use the dnl macro to start all the comment lines, as in the first four lines in the example.

· End each macro definition with the dnl macro. Otherwise, when m4 processes the macro file, it produces a blank line for each macro definition.

· Use the built-in m4 command define to define a new macro. The macro name and the value are both enclosed between a pair of left and right single quotes (' … '). Note that you cannot use the plain single quote to enclose the macro name and definition.

Now process the macro file ex.m4 by typing the following command:

m4 ex.m4

m4 processes the macros and displays the following output:

Dear Sir/Madam,
This is to inform you that we received your recent inquiry.
We will respond to your question soon.
Customer Service

Sounds just like a typical customer service form letter, doesn’t it?

If you compare the output with the ex.m4 file, you see that m4 prints the form letter on standard output, expanding the macros hello and bye into their defined values. If you want to save the form letter in a file called letter, use the shell’s output redirection feature, like this:

m4 ex.m4 > letter

What if you want to use the word hello or bye in the letter without expanding them? You can do so by enclosing these words in a pair of single quotes (' … '). You have to do so for other predefined m4 macros, such as define. To use define as a plain word, not as a macro to expand, type ‘define’.

The sendmail macro file

The simple example in the preceding section gives you an idea of how m4 macros are defined and used to create configuration files such as the file. You find many complex macros stored in files in the /usr/share/sendmail-cf directory in Fedora or the/usr/share/sendmail directory in SUSE. A top-level macro file (called in Fedora and in SUSE), described later in this section, brings in these macro files with the include macro (used to copy a file into the input stream).

 width= To avoid repeatedly mentioning different file and directory names for different distributions such as Fedora and SUSE, I use the file and directory names for Fedora in the following discussions. The general discussions apply to sendmail in all Linux distributions, but you have to replace the file and directory names with those for your specific distribution.

By defining its own set of high-level macros in files located in the /usr/share/sendmail-cf directory, sendmail essentially creates its own macro language. The sendmail macro files use the .mc extension. The primary sendmail macro file you configure, located in the /etc/mail directory.

Compared to the /etc/mail/ file, the /etc/mail/ file is shorter and easier to work with. Here are some lines from the /etc/mail/ file that comes with Fedora:

dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/, you will need to regenerate the
dnl # /etc/mail/ file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl # /etc/mail/make
dnl #
VERSIONID('setup for linux')dnl
dnl #
dnl # Do not advertise sendmail version.
dnl #
dnl define('confSMTP_LOGIN_MSG', '$j Sendmail; $b')dnl
dnl #
dnl # default logging level is 9, you might want to set it higher to
dnl # debug the configuration
dnl #
dnl define('confLOG_LEVEL', '9')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl define('SMART_HOST', 'smtp.your.provider')dn
. . . lines deleted . . .
dnl #
dnl MASQUERADE_AS('')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just, but @* as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
dnl MAILER(cyrusv2)dnl

tip.eps If you make changes to the /etc/mail/ file, you must generate the /etc/mail/ file by running the file through the m4 macro processor with the following command. (You have to log in as root.)

m4 /etc/mail/ > /etc/mail/

The comments also tell you that you need the sendmail-cf package to process this file.

From the previous section’s description of m4 macros, you can see that the file uses define to create new macros. You can also see the liberal use of dnl to avoid inserting too many blank lines into the output.

The other uppercase words (such as OSTYPE, FEATURE, and MAILER) are sendmail macros. These are defined in the .m4 files located in the subdirectories of the /usr/share/sendmail-cf directory and are incorporated into the file with the followinginclude macro:


The /usr/share/sendmail-cf/m4/cf.m4 file, in turn, includes the cfhead.m4 file, which includes other m4 files, and so on. The net effect is as follows: As the m4 macro processor processes the file, the macro processor incorporates many m4 files from various subdirectories of /usr/share/sendmail-cf.

Here are some key points to note about the /etc/mail/ file:

· VERSIONID('setup for linux') macro inserts the version information enclosed in quotes into the output.

· OSTYPE('linux') specifies Linux as the operating system. You have to specify this macro early to ensure proper configuration.

tip.eps Placing this macro right after the VERSIONID macro is customary.

· MAILER(smtp) describes the mailer. According to instructions in the /usr/share/sendmail-cf/README file, MAILER declarations are always placed at the end of the file and MAILER(smtp) always precedesMAILER(procmail). The mailer smtp refers to the SMTP mailer.

· FEATURE macros request various special features. For example, FEATURE('blacklist_recipients') turns on the capability to block incoming mail for certain usernames, hosts, or addresses. The specification for what mail to allow or refuse is placed in the access database (stored in /etc/mail/access.db file). You also need the FEATURE('access_db') macro to turn on the access database.

· MASQUERADE_AS('') causes sendmail to label outgoing mail as having come from the host (replace mydomain with your domain name). The idea is for a large organization to set up a single sendmailserver that handles the mail for many subdomains and makes everything appear to come from a single domain. (For example, mail from many departments in a university appears to come from the university’s main domain name.)

· MASQUERADE_DOMAIN( instructs sendmail to send mail from an address such as as having originated from the same username at the domain specified by theMASQUERADE_AS macro.

The sendmail macros such as FEATURE and MAILER are described in the /usr/share/sendmail-cf/README file. Consult that file to find out more about the sendmail macros before you make changes to the file.

Syntax of the file

The file’s syntax is designed to be easy for the sendmail program to parse because sendmail reads this file whenever it starts. Human readability was not a primary consideration when the file’s syntax was designed. Still, with a little explanation, you can understand the meaning of the control lines in

Each sendmail control line begins with a single-letter operator that defines the meaning of the rest of the line. A line that begins with a space or a tab is considered a continuation of the previous line. Blank lines and lines beginning with a pound sign (#) are comments.

Often, no space appears between the single-letter operator and the arguments that follow the operator, which makes the lines even harder to understand. For example, uses the concept of a class — essentially a collection of phrases. You can define a class named P and add the phrase REDIRECT to that class with the following control line:


Because everything runs together, the command is hard to decipher. On the other hand, to define a class named Accept and set it to the values OK and RELAY, write the following:


This command may be slightly easier to understand because the delimiters (such as the class name, Accept) are enclosed in curly braces.

Other, more recent control lines are even easier to understand. For example, the line

O HelpFile=/etc/mail/helpfile

defines the option HelpFile as the filename /etc/mail/helpfile. That file contains help information that sendmail uses when it receives a HELP command.

Table 5-1 summarizes the one-letter control operators used in Each entry also shows an example of that operator. This table helps you understand some of the lines in

Table 5-1 Control Operators Used in




Defines a class, a variable (think of it as a set) that can contain several values. For example, Cwlocalhost adds the name localhost to the class w.


Defines a macro, a name associated with a single value. For example, DnMAILER-DAEMON defines the macro n as MAILER-DAEMON.


Defines a class that’s been read from a file. For example, Fw/etc/mail/local-host-names reads the names of hosts from the file /etc/mail/local-host-names and adds them to the class w.


Defines the format of header lines that sendmail inserts into a message. For example, H?P?Return-Path: <$g> defines the Return-Path: field of the header.


Defines a map (a key-value pair database). For example, Karith arith defines the map named arith as the compiled-in map of the same name.


Specifies a mailer. The following lines define the procmail mailer: Mprocmail,P=/usr/bin/procmail,F=DFMSPhnu9,S=EnvFromSMTP/HdrFromSMTP,R=EnvToSMTP/HdrFromSMTP,T=DNS/RFC822/X-Unix,A=procmail -Y -m $h $f $u.


Assigns a value to an option. For example, O AliasFile=/etc/aliases defines the AliasFile option to /etc/aliases, which is the name of the sendmail alias file.


Defines values for the precedence field. For example, Pjunk=-100 sets to -100 the precedence of messages marked with the header field Precedence: junk.


Defines a rule. (A rule has a left side and a right side; if input matches the left side, the right side replaces it. This rule is called rewriting.) For example, the rewriting rule R$* ; $1 strips trailing semicolons.


Labels a ruleset you can start defining with subsequent R control lines. For example, Scanonify=3 labels the next ruleset as canonify and ruleset 3.


Adds a username to the trusted class (class t). For example, Troot adds root to the class of trusted users.


Defines the major version number of the configuration file.

Other sendmail files

The /etc/mail directory contains other files that sendmail uses. These files are referenced in the sendmail configuration file, /etc/mail/ in Fedora and /etc/ in SUSE. For example, here’s how you can search for the /etc/mail string in the /etc/mail/ file in Fedora:

grep "\/etc\/mail" /etc/mail/

Here’s what the grep command displays as a result of the search on a typical Fedora system:

FR-o /etc/mail/relay-domains
Kmailertable hash -o /etc/mail/mailertable.db
Kvirtuser hash -o /etc/mail/virtusertable.db
Kaccess hash -T<TMPF> -o /etc/mail/access.db
#O ErrorHeader=/etc/mail/error-header
O HelpFile=/etc/mail/helpfile
O UserDatabaseSpec=/etc/mail/userdb.db
#O ServiceSwitchFile=/etc/mail/service.switch
#O DefaultAuthInfo=/etc/mail/default-auth-info

You can ignore the lines that begin with a hash mark, or number sign (#) because sendmail treats those lines as comments. The other lines are sendmail control lines that refer to other files in the /etc/mail directory.

Here’s what some of these sendmail files are supposed to contain. (Note that not all of these files have to be present in your /etc/mail directory, and even when present, some files may be empty.)

· /etc/mail/access: Names or IP addresses or both of hosts allowed to send mail (useful in stopping spam — unwanted e-mail).

· /etc/mail/access.db: Access database generated from the /etc/mail/access file.

· /etc/mail/helpfile: Help information for SMTP commands.

· /etc/mail/local-host-names: Names by which this host is known.

· /etc/mail/mailertable: Mailer table used to override how mail is routed. (For example, the entry tells sendmail that mail addressed to has to be sent

· /etc/mail/relay-domains: Hosts that permit relaying.

· /etc/mail/trusted-users: List of users allowed to send mail using other users’ names without a warning.

· /etc/mail/userdb.db: User database file containing information about each user’s login name and real name.

· /etc/mail/virtusertable: Database of users with virtual-domain addresses hosted on this system.

technicalstuff.eps The /etc/mail directory sometimes contains other files — /etc/mail/certs and the files with the .pem extension — that are meant for supporting Privacy Enhanced Mail (PEM) in sendmail by using the STARTTLS extension to SMTP. The STARTTLS extension uses TLS (more commonly known as SSL — Secure Sockets Layer) to authenticate the sender and encrypt mail. RFC 2487 describes STARTTLS. (This RFC is available online at

tip.eps If you edit the /etc/mail/mailertable file, you have to type the following command before the changes take effect:

makemap hash /etc/mail/mailertable < /etc/mail/mailertable

Here is an easier way to make sure that you rebuild everything necessary after making any changes — just type the following commands while logged in as root:

cd /etc/mail

The first command changes the current directory to /etc/mail, and the second command runs the make command, which reads a file named Makefile in /etc/mail to perform the steps necessary to rebuild everything. (To find out more about make and Makefile, see Book VII, Chapter 3.)

The .forward file

Users can redirect their own mail by placing a .forward file in their home directory. The .forward file is a plain-text file with a comma-separated list of mail addresses. Any mail sent to the user is instead forwarded to these addresses. If the .forward file contains a single address, all e-mail for that user is redirected to that single e-mail address. For example, suppose a .forward file containing the following line is placed in the home directory of a user named emily:


This line causes sendmail to automatically send all e-mail addressed to emily to the username ashley on the same system. User emily does not receive mail at all.

You can also forward mail to a username on another system by listing a complete e-mail address. For example, you can add a .forward file with the following line to send messages addressed to username wilbur to the mail address

To keep a copy of the message on the original system, in addition to forwarding to the preceding specified address, add the following line to the .forward file:, wilbur\

Simply append the username and end the line with a backslash (\). The backslash at the end of the line stops sendmail from repeatedly forwarding the message.

The sendmail alias file

In addition to the file, sendmail also consults an alias file named /etc/aliases to convert a name into an address. The location of the alias file appears in the sendmail configuration file.

Each alias is typically a shorter name for an e-mail address. The system administrator uses the sendmail alias file to forward mail, to create a mailing list (a single alias that identifies several users), or to refer to a user by several different names. For example, here are some typical aliases:

brown: glbrown
all: jessica, isaac, alex, caleb, glbrown

remember.eps After defining any new aliases in the /etc/aliases file, you must log in as root and make the new alias active by typing the following command:

sendmail -bi

Installing the INN Server

This section describes how to configure InterNetNews (INN), a TCP/IP-based news server. First you have to install INN.

 width= In Debian, Ubuntu, and Xandros, type dpkg -l inn* to see whether inn is installed. In Fedora and SUSE, type rpm -q inn and see whether the inn package is installed.

 width= In Debian and Ubuntu, type apt-get install inn to install the INN server. In Fedora, log in as root, mount the DVD, and type cd /media/cdrom/Fedora/RPMS followed by rpm -ivh inn*. In SUSE, click Software Management in the YaST Control Center’s Software category. Then use YaST’s search feature to look for inn, select the relevant packages from the search results, and install them. In Xandros, first run Xandros Networks, choose Edit⇒Set Application Sources, and click the Debian Unsupported Site link as a source. Then type apt-get install inn to install the INN server.

Configuring and Starting the INN Server

Much of the INN (InterNetNews) software is ready to go as soon as you install it. All you need to do is to brush up a bit on the various components of INN, edit the configuration files, and start innd — the INN server. The INN server is sometimes referred to as the news server.

If you want to run a news server that supports a selection of Internet newsgroups, you also have to arrange for a news feed — the source from which your news server gets the newsgroup articles. Typically, you can get a news feed from an ISP, but the ISP charges an additional monthly fee to cover the cost of resources required to provide the feed. (Your normal ISP charges cover reading news from the ISP’s server; you have to pay additional charges only if you want to run your own server and get a news feed.) You need the name of the upstream server that provides the news feed, and you have to provide that server with your server’s name and the newsgroups you want to receive.

By the way, you don’t need an external news feed if you’re running a news server to support local newsgroups that are available only within your organization’s network. How to set up local newsgroups is described in the “Setting Up Local Newsgroups” section of this chapter.

Depending on the newsgroups you want to receive and the number of days you want to retain articles, you have to set aside appropriate disk space to hold the articles. The newsgroups are stored in a directory hierarchy (based on the newsgroup names) in the /var/spool/newsdirectory of your system. If you’re setting up a news server, you may want to devote a large disk partition to the /var/spool/news directory.

In your news server’s configuration files, enter the name of the server providing the news feed. At the same time, add to the configuration files the names of any downstream news servers (if any) that receive news feeds from your server. Then you can start the news server and wait for news to arrive. Monitor the log files to ensure that the news articles sort and store properly in the /var/spool/news directory on your system.

The following sections introduce you to INN setup, but you can find out more about INN from the Internet Systems Consortium (ISC), a nonprofit corporation dedicated to developing and maintaining open source Internet software, such as BIND (an implementation of Domain Name System), DHCP (Dynamic Host Configuration Protocol), and INN. Rich Salz originally wrote INN; ISC took over the development of INN in 1996. You can find out more about INN and can access other resources at ISC’s INN web page at (click on theOther Software link).

InterNetNews components

INN includes several programs that deliver and manage newsgroups. It also includes a number of files that control how the INN programs work. The most important INN programs are the following:

· innd: Accepts connections from other feed sites, as well as from local newsreader clients, but it hands off local connections to the nnrpd. The news server innd runs as a daemon (a background process that keeps itself running to provide a specific service) and listens on the NNTP port (TCP port 119).

· nnrpd: Handles requests from local newsreader clients. nnrpd is a special server invoked by innd.

· expire: Removes old articles based on the specifications in the text file /etc/news/expire.ctl.

· nntpsend: Invokes the innxmit program to send news articles to a remote site by using NNTP. The configuration file /etc/news/nntpsend.ctl controls the nntpsend program.

· ctlinnd: Enables you to control the innd server interactively. The ctlinnd program can send messages to the control channel of the innd server.

The other vital components of INN are the control files. Most of these files are in the /etc/news directory of your Linux system, although a few are in the /var/lib/news directory. Between those two directories, you have more than 30 INN control files. Some important files include the following:

· /etc/news/inn.conf: Specifies configuration data for the innd server. (To view online help for this file, type man inn.conf.)

· /etc/news/newsfeeds: Specifies what articles to feed downstream to other news servers. (The file is complicated, but you can get help by typing man newsfeeds.)

· /etc/news/incoming.conf: Lists the names and addresses of hosts that provide news feeds to this server. (To view online help for this file, type man incoming.conf.)

· /etc/news/storage.conf: Specifies the storage methods to be used when storing news articles. (To view online help for this file, type man storage.conf.)

· /etc/news/expire.ctl: Controls expiration of articles, on a per-newsgroup level, if desired. (To view online help for this file, type man expire.ctl.)

· /var/lib/news/active: Lists all active newsgroups, showing the oldest and newest article number for each, and each newsgroup’s posting status. (To view online help for this file, type man active.)

· /var/lib/news/newsgroups: Lists newsgroups and a brief description of each.

· /etc/news/readers.conf: Specifies hosts and users who are permitted to read news from this news server and post news to newsgroups. The default file allows only the localhost to read news; you have to edit it if you want to allow other hosts in your local area network to read news. (To view online help for this file, type man readers.conf.)

The next few sections describe how to set up some of the important control files.

The inn.conf file

The inn.conf file holds configuration data for all INN programs — which makes it the most important file. Each line of the file has the value of a parameter in the following format:

parameter: value

Depending on the parameter, the value is a string, a number, or true or false. As in many other configuration files, comment lines begin with a pound sign (#).

Most of the parameters in the default inn.conf file in the /etc/news directory do not require changes. You may want to edit one or more of the parameters shown in Table 5-2.

Table 5-2 Configuration Parameters in /etc/news/inn.conf

Parameter Name

Set This To


The command used to start the mail transfer agent that is used by innd to transfer messages. The default is to use sendmail.


The name of your organization in the way you want it to appear in the Organization: header of all news articles posted from your system. Users may override this parameter by defining the ORGANIZATION environment variable.


The type of overview storage method. (The overview is an index of news articles in the newsgroup.) The default method is tradindexed, which is fast for reading news but slow for storing news items.


The name of your news server as you want it to appear in the Path header of all postings that go through your server. If pathhost isn’t defined, the fully qualified domain name of your system is used.


The full pathname of the directory that contains INN binaries and libraries. The default pathnews is set to /usr/lib/news.


The domain name for your server.


True if you want INN to support the NEWNEWS command from newsreaders. In the past, this option was set to false because the NEWNEWS command used to reduce the server’s performance, but now the default is set to true because modern servers can easily handle the NEWNEWS command.


The size in kilobytes that you want INN to use for caching recently received message IDs that are kept in memory to speed history lookups. This cache is used only for incoming feeds, and a small cache can hold quite a few history file entries. The default setting of 0 disables history caching. If you have more than one incoming feed, you may want to set this parameter to a value of 256 (for 256KB).


Any flags you want to pass to the INN server process when it starts.

The newsfeeds file

The newsfeeds file (found at /etc/news/newsfeeds) specifies how incoming news articles are redistributed to other servers and to INN processes. If you provide news feeds to other servers, you have to list these news feeds in this file. (You also must have an entry labeled ME, which serves a special purpose explained later in this section.)

The newsfeeds file contains a series of entries, one for each feed. Each feed entry has the following format:

site[/exclude,exclude … ]\
:pattern,pattern . . . [/distrib,distrib . . . ]\
:flag,flag . . .\

Each entry has four fields separated by a colon (:). Usually the entries span multiple lines, and a backslash (\) at the end of the line continues a line to the next. Here’s what the four fields mean:

· The first field, site, is the name of the feed. Each name must be unique, and for feeds to other news servers, the name is set to the hostname of the remote server. Following the name is an optional slash and an exclude list (/exclude,exclude … ) of names. If any of the names in this list appear in the Path line of an article, that article isn’t forwarded to the feed. You can use an exclude list if you don’t want to receive articles from a specific source.

· The second field is a comma-separated list of newsgroup patterns, such as *,@alt.binaries.warez.*,!control*,!local*, followed by an optional distribution list. The distribution list is a list of comma-separated keywords, with each keyword specifying a specific set of sites to which the articles are distributed. The newsgroup patterns essentially define a subscription list of sites that receive this news feed. An asterisk (*) matches all newsgroups. A pattern beginning with @ causes newsgroups matching that pattern to be dropped. A pattern that begins with an exclamation mark (!) means the matching newsgroups are not sent. The simple pattern-matching syntax used in INN configuration files is referred to as a wildmat pattern.

· The third field is a comma-separated list of flags — fields that determine the feed-entry type and set certain parameters for the entry. You see numerous flags; type man newsfeeds and read the man page for more information about the flags.

· The fourth field is for parameters whose values depend on the settings in the third field. Typically this field contains names of files or external programs that the INN server uses. You can find more about this field from the newsfeeds man page.

Now that you know the layout of the /etc/news/newsfeeds file, you can study that file as an example. The default file contains many sample feed entries, but only two are commented out:

· ME is a special feed entry that’s always required. It serves two purposes. First, the newsgroup patterns listed in this entry are used as a prefix for all newsgroup patterns in all other entries. Second, the ME entry’s distribution list determines what distributions your server accepts from remote sites.

· The controlchan feed entry is used to set up INN so that an external program is used to handle control messages. (These messages are used to create new newsgroups and remove groups.) For example, the following controlchan entry specifies the external program /usr/lib/news/bin/controlchan to handle all control messages, except cancel messages (meant for canceling an article):


In addition to these feed entries, you add entries for any actual sites to which your news server provides news feeds. Such entries have the format\

where is the fully qualified domain name of the site to which your system sends news articles.

The incoming.conf file

The incoming.conf file describes which hosts are allowed to connect to your host to feed articles. For a single feed, you can add an entry like

peer mybuddy {

where mybuddy is a label for the peer and identifies the site that feeds your site.

remember.eps Keep in mind that simply adding a site’s name in the incoming.conf file does not cause that remote site to start feeding news to your site; it simply enables your server to accept news articles from the remote site. At the remote site, your buddy has to configure his or her server to send articles to your site.

The readers.conf file

The readers.conf file specifies the hostnames or IP addresses from which newsreader clients (such as Mozilla) can retrieve newsgroups from your server. For example, the following readers.conf file allows read access and post access (meaning you can submit articles) from localhost and from any host in the network

auth "localhost" {
hosts: "localhost,, stdin"
default: "<localhost>"
access "localhost" {
users: "<localhost>"
newsgroups: "*"
access: RPA
auth "localnet" {
default: "<localnet>"
access "localnet" {
users: "<localnet>"
newsgroups: "*"
access: RPA

InterNetNews startup

In addition to the configuration files, you also have to initiate cron jobs that perform periodic maintenance of the news server. In Fedora, these cron jobs are already set up. Therefore, you’re now ready to start the INN server — innd.

Before you start innd, you must run makehistory and makedbz to initialize and rebuild the INN history database. Type man makehistory and man makedbz to find out more about these commands. To create an initial history database, associated indexes, and set the ownerships and permissions of some files, type the following commands:

/usr/lib/news/bin/makehistory -b -f history -O -l 30000 -I
cd /var/lib/news
/usr/lib/news/bin/makedbz -s 'wc -l < history' -f history
chown *
chown /var/spool/news/overview/group.index
chmod 664 /var/spool/news/overview/group.index

 width= To start innd in Fedora, log in as root and type /etc/init.d/innd start. (Alternatively, you can type service innd start.) In Debian, SUSE, Ubuntu, and Xandros, type /etc/init.d/inn start. To ensure that innd starts at boot time, type chkconfig --level 35 innd on in Fedora andchkconfig --level 35 inn on in SUSE. In Debian and Xandros, type update-rc.d inn defaults.

tip.eps If you make any changes to the INN configuration files, remember to restart the server by invoking the /etc/init.d script with restart as the argument.

Setting Up Local Newsgroups

If you want to use newsgroups as a way to share information within your company, you can set up a hierarchy of local newsgroups. Then you can use these newsgroups to create virtual communities within your company, where people with shared interests can informally discuss issues and exchange knowledge.

Defining a newsgroup hierarchy

The first task is to define a hierarchy of newsgroups, deciding what each newsgroup discusses. For example, if your company name is XYZ Corporation, here’s a partial hierarchy of newsgroups you might define:

· xyz.general: General items about XYZ Corporation

· Weekly news

· The weekly cafeteria menu and any discussions about it

· A listing of items offered for sale by employees

· Job openings at XYZ Corporation

· xyz.wanted: Wanted (help, items to buy, and so on) postings by employees

· xyz.technical.hardware: Technical discussions about hardware

· Technical discussions about software

Updating configuration files

Following are the steps you follow to update the configuration files for your local newsgroups and restart the news server:

1. Add descriptive entries for each newsgroup to the /var/lib/news/newsgroups file.

Add to this file a line for each local newsgroup — type its name followed by a brief description. For example, here’s what you might add for the xyz.general newsgroup:

xyz.general General items about XYZ Corporation

2. Edit the ME entry in the /etc/news/newsfeeds file and add the phrase ,!xyz.* to the comma-separated list of newsgroup patterns.

This step ensures that your local newsgroups are not distributed outside your site.

3. Add a storage method to use for the local newsgroups.

For example, you can add the following lines in /etc/news/storage.conf to define the storage method for the new xyz hierarchy of newsgroups (change xyz to whatever you name your local newsgroups):

method tradspool {
class: 1
newsgroups: xyz.*

4. To make these changes effective, restart the news server.

Type service innd restart in Fedora or /etc/init.d/inn restart in Debian, SUSE, Ubuntu, and Xandros.)

Adding the newsgroups

The final step is to add the newsgroups. After you update the configuration files and run innd, adding a local newsgroup is easy. Log in as root and use ctlinnd to perform this task. For example, here’s how you add a newsgroup named xyz.general:

/usr/lib/news/bin/ctlinnd newsgroup xyz.general

That’s it! That command adds the xyz.general newsgroup to your site. If you use the traditional storage method, the innd server creates the directory /var/spool/news/articles/xyz/general the first time an article is posted and stores articles for that newsgroup in that directory.

After you create all the local newsgroups, users from your intranet can post news articles and read articles in the local newsgroups. If they have problems accessing the newsgroups, make sure that the /etc/news/readers.conf file contains the IP addresses or names of the hosts that have access to the innd server.

Testing your newsgroups

For example, add a newsgroup named on an INN server running on your Linux system by using the instructions explained in the previous sections. Then start a newsreader and set up a new news account with the news server set to the INN server. Then access newsgroup. Try it! You’ll like it