Instiq
Chapter 4 · Email services·v1.0.0·Updated 7/7/2026·~12 min

What's changed: Initial version (topic 2.10, subtopics 2.10.1–2.10.2)

4.1Configuring and Managing Postfix

Key points

Learn how Postfix (an MTA) is configured: the split between /etc/postfix/main.cf (runtime parameters) and master.cf (service/daemon definitions), address rewriting via /etc/aliases, the queue layout under /var/spool/postfix/, checking logs, SMTP authentication (SASL) and TLS encryption, the basics of the SMTP protocol, and where exim fits as an alternative MTA.

Email works through a division of roles: sending (an MTA), receiving and delivering (an MDA), and retrieving (an MRA). Postfix fills the MTA role and is the most widely deployed mail transfer agent on Linux. Rather than memorizing settings, having a map of "which file decides what" is the shortcut for both real work and the exam.

4.1.1main.cf, master.cf, and aliases

  • Config files live under /etc/postfix/. main.cf holds the daemon's runtime parameters (accepted domains, relay permissions, TLS settings, etc.) as one parameter per line. master.cf is a table defining which services (smtp, submission, pickup, ...) run as which processes.
  • Redirect destinations via /etc/aliases (e.g., root: admin@example.com forwards mail addressed to root). After editing, you must run newaliases (or postalias) to rebuild the hashed database—without it, the change has no effect.
  • Mail is not always delivered instantly—it passes through queues under /var/spool/postfix/ (incoming, active, deferred, hold, corrupt, etc.). Inspect or force-flush stuck mail with postqueue and postsuper.
  • Runtime logs land under /var/log/ (often /var/log/maillog or /var/log/mail.log, or via journalctl on systemd-based systems), and are the first place to check for delivery or authentication failures.

4.1.2SMTP auth, TLS, and the protocol

  • The SMTP protocol is a text-based command/response exchange (HELO/EHLO, MAIL FROM, RCPT TO, DATA, QUIT). Port 25 is typically used for server-to-server relay, while port 587 is commonly used for client submission.
  • SMTP authentication (SASL) lets legitimate users submit mail while blocking open relay abuse: clients authenticate with a username and password during the SMTP session before being allowed to send.
  • Encryption is handled with TLS. Authentication and TLS are typically combined so credentials are never sent in the clear.
Exam point

The core traps: main.cf holds parameters, master.cf defines services, aliases changes require newaliases, and mail passes through a queue rather than arriving instantly. On the SMTP side, expect questions on combining auth with TLS to avoid sending plaintext passwords.

The troubleshooting habit that pays off: check the queue and logs before doubting the configuration. If mail is not arriving, first check for backlog with postqueue -p (or mailq), then trace SMTP reply codes and delivery failure reasons in the mail log under /var/log/. Redirecting operational notices sent to root via /etc/aliases is common work, but forgetting to run newaliases afterward is a classic pitfall—the change silently has no effect. When enabling SMTP authentication, you set SASL-related parameters in main.cf (whether to require auth, which paths permit it) while master.cf provides the TLS-capable service entry (for example, a submission service listening on port 587)—keeping this two-file division of labor in mind makes the setup easier to reason about. Postfix is not the only choice on Linux: exim is a historically popular alternative MTA with a different configuration philosophy and file layout, but it shares the same role of speaking SMTP as an MTA.

File / commandRoleNotes
/etc/postfix/main.cfPostfix daemon runtime parametersAccepted domains, TLS, SASL settings
/etc/postfix/master.cfDefinitions of services to runsmtp, submission, etc. as a table
/etc/aliases + newaliasesAddress redirectionAlways rebuild the DB with newaliases after edits
/var/spool/postfix/Mail queueincoming, active, deferred, etc.
Warning

Trap: "editing /etc/aliases immediately activates the forward" is wrong—aliases is just a text file; Postfix consults a hashed database built from it, so the change has no effect until newaliases runs. Also watch for swapped roles: main.cf = parameters, master.cf = service definitions—not the other way around.

Relationship of main.cf, master.cf, aliases, and the queue, plus the SMTP auth + TLS flow.
main.cf = parameters, master.cf = services

4.1.3Section summary

  • main.cf = parameters / master.cf = service definitions / aliases need newaliases / mail flows through a queue
  • SMTP auth (SASL) + TLS lets legitimate users submit mail without sending plaintext passwords. exim is an alternative MTA

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. You edited /etc/aliases to forward mail addressed to root to admin@example.com. What must you do next to activate the change?

Q2. In Postfix, which file defines which services (smtp, submission, etc.) run as which processes?

Q3. For client mail submission, you want to block open relay while allowing only legitimate users to send, without exposing credentials in plaintext. Which combination should you use?

Check your understandingPractice questions for Chapter 4: Email services

Keep track of your progress

The full study guide is free to read. Sign up free to practice with the question bank, track what you have read, review your mistakes, and highlight passages.