A high-capacity POP3 server on a Linux system

Source: Internet
Author: User
Tags define command line comments file system hash mail linux

POP3 (Post Office Protocol 3), the 3rd version of the Post Office agreement, provides a way to connect a personal computer to a mail server on the Internet and an electronic protocol to download e-mail. It is the first offline protocol standard for Internet e-mail, POP3 allows users to store messages on the local host from the server while deleting messages stored on the mail server, and POP3 servers follow the POP3 protocol's receiving mail server to receive e-mail. This article describes how to use open source software procmail and Qpopper to configure a POP3 server on a Linux system that can be used by a large number of users.

1. Download Procmail and Qpopper

Procmail can be downloaded from http://www.procmail.org/procmail-3.21.tar.gz.

Qpopper can be downloaded from http://www.eudora.com/qpopper_general/.

2, compile Qpopper

Suppose the downloaded file is placed in the/root

#cd/root

#tar XVFZ qpopper4.0.3.tar.gz

#cd qpopper4.0.3

#./configure--enable-hash-spool=2

--enable-log-login

--enable-server-mode

--enable-fast-update

--enable-shy

--enable-spool-dir=/usr/mail

--enable-specialauth

Comments:

--enable-specialauth Use/etc/shadow password Authentication

--enable-hash-spool=2 uses level two hash structure

--enable-spool-dir=/usr/mail The user mailbox file is/usr/mail/j/e/jephe

--enable-log-login Record of successful POP3 login into syslog

--enable-server-mode and--enable-fast-update

Do not let Qpopper copy mailbox files to temporary files when users access mailboxes, reduce disk I/O, and enhance performance.

--enable-shy do not display version information when responding to a server, enhancing security.

#make

#make Install

Edit File/etc/inetd.conf

Create the file POP3 under/ETC/XINETD.D and include the following:

Service POP3
{
Socket_type = Stream
protocol = TCP
wait = no
user = root
Server =/usr/local/lib/popper
Server_args = qpopper-f-s-s-c-r-t120
Port = 110
}

Comments:

-F Enable fast update

-S Enable server mode (done when the user does not have shell access to the server)

-S opens log feature

-C ignores the case of the user name

-R does not reverse domain name check for incoming IP address

-T set timeout time

After this setting, if the user jephe the letter, lock the mailbox file/usr/mail/j/e/jephe create the lock file. Jephe.pop, check the number of letters, back out of the update status, generate. jephe.cache file.

Otherwise, the normal mode is to first copy the/usr/mail/j/e/jephe into the. Jephe.pop, the final user check the mailbox and then copy back, increased I/O processing time

If it is not redhat, the line that begins with Pop-3 is commented on in/etc/inetd.conf, and the following line is added later: pop-3 stream TCP nowait.400 root/usr/local/sbin/popper-f -c-r-t120

400 in nowait:400 refers to the maximum number of connection requests per minute

If you set the All:all in the/etc/hosts.deny, enter it in the/etc/hosts.allow

Popper:all

3, compile Procmail

Suppose the downloaded file is placed in the/root

#cd/root

#tar XVFZ procmail-3.21.tar.gz

#cd procmail-3.21

#vi src/authenticate.c

Change #define MAILSPOOLDIR The/var/spool/mail behind the line is "/usr/mail/" (Here is/usr/mail)

Change #define Mailspoolhash 0 to 2 (use a two-level hash directory to improve server file system performance, especially when there are large numbers of users)


Note: In this case, if the user's mailbox is jephe@domain.com, the file should exist

/usr/mail/j/e/jephe

#mv/var/spool/mail/var/spool/mail.bak

Note: Change this directory first, because it is possible to use this directory and the hash hierarchy if the directory can be found at compile time, which will store the user's mail to the file/var/spool/mail/j/e/ Jephe. If you want to use this directory, you do not need to change the Mailspooldir line above.

#make

#make Install

#make Install-suid

Then run #procmail-v as root to verify that the user's mail path is/usr/mail/r/o/root.

4. Create POP3 Users

You do not need to assign a home directory to mail users, and you do not need to set the primary directory to/usr/mail/j/e (assuming the user is Jephe) and create the user with the following command.

#useradd jephe-c "Jephe Wu"-G mail-d/dev/null-s/bin/false

You can then write a batch command with CHPASSWD to each user with the same password.

1 First use passwd for Mailuser1 set the password, assume "abc123", check the password in/etc/shadow.

2 Create a new file/tmp/password, each line includes a username, password, can be obtained from the/etc/passwd with the following command.

CAT/ETC/PASSWD awk-f: ' {print $} ' sed-e

' S/$/:$$1$g22plicn$r5.bse0u7dbahn7tcevtr//g '

C. Then run CHPASSWD </tmp/password

5. FAQ

After compiling qpopper, you still need to use the-f-s parameter on the command line to start server mode and quick Update, please put-F before-S.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.