[XenoCafe Logo] Click for Homepage
Home Tutorials Forum Blog Advertising Links Contact About

 



Sendmail and SMTP AUTH on RedHat Linux 9
Part 3 - Configuring Domains and Email Accounts

Written by Tony Bhimani
December 5, 2004

Requirements
RedHat Linux 9
Sendmail 8.12.8
Cyrus SASL 2.1.10

Before we can use our mail server we will need to add a domain and email accounts (although we will only add one for the example). This time I won't be able to use the infamous somefakedomain.com, so instead I'll be using xenosoftware.com which is a working domain. Be sure to configure the DNS MX record for your domain before you continue with this part. More information can be found in my DNS tutorials for Linux or Windows. To configure email accounts in Sendmail, you have to create real accounts on the system using useradd, whereas MTA's like qmail use virtual users (which I feel is better for email-only users).

There are two files we will need to edit in the /etc/mail directory: local-host-names and virtusertable. local-host-names contains a list of all the domains your Sendmail server handles mail for. virtusertable is where you set up the mapping of an email address to Linux system accounts.

To begin, we will add a new domain to local-host-names. First switch to the /etc/mail directory and open local-host-names in vi.

cd /etc/mail
vi local-host-names

Go into insert mode (press i) and add your domain name to the file. If you have more then one domain then make sure each one is on its own line.

When you are done adding your domain(s), save your changes and exit vi (press ESC, type :wq and press enter).

Now we have to add a Linux system account for the mailbox. We'll create a user called webmaster and assign a password. Issue these commands.

useradd webmaster
passwd webmaster
[enter password]
[confirm password]

Create a user for each mailbox you want to add and set their passwords.

The mapping for our mailbox needs to be added to the virtusertable file. The format for entries is the email address followed by a tab (or a space) and then the system account. To set up a catch-all default address (where email sent to any address for the domain gets dropped into a single mailbox), omit the email address. For example, @domain.com mailbox. We will now edit the virtusertable file. Open it in vi, go into insert mode, and add the mapping.

vi virtusertable
webmaster@xenosoftware.com webmaster

Add all your mappings and when you are done, save your changes and exit vi.

To finish off the mappings we need to use the makemap utility. makemap creates a database map of key/value pairs in a hash format that Sendmail can read. Issue the following command assuming you are still in /etc/mail.

makemap -v hash ./virtusertable.db < ./virtusertable

If you are not in /etc/mail then use this instead.

makemap -v hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

You can omit the -v switch if you want. I use it to verify the key/value pairs are processed.

In RedHat 7.3, I never had to restart Sendmail for it to recognize new mailboxes, however in RedHat 9 it appears to be required (unless it's my system acting weird). Restart Sendmail so it knows about the new mailboxes.

service sendmail restart

The last part of this tutorial is testing Sendmail to verify it can send outgoing mail as well as receive it.



How would you rate the usefulness of this content?

Poor 1
2
3
4
5
6
7
8
9
Outstanding

Optional: Tell us why you rated the content this way.
Characters remaining: 1024
Average rating: 8.00 out of 9.

1 2 3 4 5 6 7 8 9
7 people have rated this content.
[ Previous Page ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ Next Page ] This page has been viewed 10,195 times
 
Copyright © 2004-2012 XenoCafe. All Rights Reserved. XenoCafe is Powered by Linux. Free your mind and your wallet. Switch to Linux.