O'Reilly logo

qmail by John Levine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15. The Users Database

In Chapter 10, we saw that local deliveries all look up the mailbox in qmail’s users database to determine both where to deliver a message, and what user and group ID and home directory to use when making the delivery. Although the most common setup of users is to deliver to the users in /etc/passwd, the users database is considerably more flexible than a mere mirror of the password file.

The users database maps each local address to a set of user data including:

  • Username

  • Numeric user ID

  • Numeric group ID

  • Home directory

  • Character to separate parts of a subaddress, usually a dash

  • Extension, used to find an appropriate qmail file

The qmail-lspawn program changes to the user and group ID and home directory before starting a delivery, then uses the separator character and extension to locate a .qmail file to control the delivery, as covered in Chapter 10.

If There’s No Users Database

If you don’t create a users database, qmail calls qmail-getpw , which implements a default mapping from login users to qmail users for each local delivery. It takes the local part, passed as its argument, and looks that up using the standard getpwnam( ) routine. If the user exists and meets some safety criteria (discussed in a moment), it returns user information for the user, uid, gid, and home directory from the password file, and null dash and extension. If the name is of the form user-extension and the username exists, it returns the user information with the dash being a literal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required