Creating POP accounts with qmail

Created by phil on Sat, 11 Dec 1999

In this example, I'll assume I want to make a pop account for a client named jimbob whose domain is called supercomm.com who wants to get POP3 mail from jimbob@supercomm.com with password mypassword.

Preliminary Steps:

  1. Install qmail. There's lots of good documentation for doing this in the distribution.

  2. Read this other documentation about enabling non-system POP3 accounts with qmail. I wrote this document to improve the existing documentation for this procedure, but you may find the old docs interesting still.

  3. Add a system account called popuser. You have to be root to do this under most typical situations.

  4. If your system uses inetd, add the following to /etc/inetd.conf and then KILL -HUP inetd:
      pop-3   stream  tcp     nowait  root     /var/qmail/bin/qmail-popup qmail-popup mail.supercomm.com checkpoppasswd /var/qmail/bin/qmail-pop3d Maildir
    Notice the reference to checkpoppasswd in this line. This should be installed in /bin/checkpoppasswd. You can pick the source for that up here

    If you're using xinetd, you should use this instead (thanks to Nitro for providing this):

      service pop3
      { 
              disable         = no
              socket_type     = stream
              protocol        = tcp
              wait            = no
              user            = root
              server          = /var/qmail/bin/qmail-popup
              server_args     = mail.supercomm.com /bin/checkpoppasswd /var/qmail/bin/qmail-pop3d Maildir
      }
    

Steps for adding POP accounts:

  1. Make the appropriate dir under /home/popuser/popboxes/ like this:
      mkdir /home/popuser/popboxes/www.supercomm.com/
  2. Make him a dir for his .qmail file and his mail:
      mkdir /home/popuser/popboxes/www.supercomm.com/jimbob/
  3. Make him a Maildir/ (technical qmail word - look it up!):
      mkdir /home/popuser/popboxes/www.supercomm.com/jimbob/Maildir/
      mkdir /home/popuser/popboxes/www.supercomm.com/jimbob/Maildir/cur/
      mkdir /home/popuser/popboxes/www.supercomm.com/jimbob/Maildir/new/
      mkdir /home/popuser/popboxes/www.supercomm.com/jimbob/Maildir/tmp/
  4. Make him a .qmail file telling qmail where to put his mail:
    /home/popuser/popboxes/www.supercomm.com/jimbob/.qmail should contain one line:
    /home/popuser/popboxes/www.supercomm.com/jimbob/Maildir/
  5. Chown everything over to popuser and set permissions:
      chown -R popuser.popuser /home/popuser/popboxes/www.supercomm.com/
      chmod -R 700 /home/popuser/popboxes/www.supercomm.com/
      chmod  600 /home/popuser/popboxes/www.supercomm.com/jimbob/.qmail
  6. Edit /var/qmail/control/virtualdomains to contain this line:
    www.supercomm.com:supercomm
  7. Edit /var/qmail/control/rcpthosts to contain this line:
    supercomm.com
  8. Edit /var/qmail/users/assign to contain this new line (This line is long and does begin with an "equals" sign)
    =supercomm-jimbob:popuser:513:513:/home/popuser/popboxes/www.supercomm.com/jimbob/:::
    (Note: The last line of the assign file should be a dot '.' no quotes)

  9. Run this command as root:
      /var/qmail/bin/qmail-newu
  10. Add a password for the user by adding a line to /var/qmail/users/poppasswd:
    jimbob:[hashed_password]:popuser:/home/popuser/popboxes/www.supercomm.com/jimbob
    Here's a quick command line perl thingy for making a crypt'd password:
      $ perl -e "print crypt('mypassword', 'Sa')";
    The 'Sa' can be any two chars - it's the salt for the crypt function.

  11. Kill -HUP the qmail-send process (as root).

ALSO:

Pay attention to where I have put / forward slash characters in the files.... For instance, jimbob is not the same as jimbob/ in all case.

Valid HTML 4.0!


Converted to HTML by Bart