CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
  • Week 1
    • 1.Operating Systems and Linux: What the Kernel Does
    • 2.Free Software and Distributions: The Ecosystem Built by Licenses
    • 3.Installation and Booting: From the Moment You Power On
    • 4.Filesystem Structure and File Types: Everything Is a File
    • 5.Week 1 Comprehensive Review: Time to See Through the Concepts
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
    • 1.Mail Services: The MTA, MDA, MUA and SMTP, POP3, IMAP Triangle
    • 2.File Transfer Services: FTP Active/Passive Modes and vsftpd
    • 3.The Standard for Remote Access: SSH, sshd_config, Key Authentication, and Port Forwarding
    • 4.Remote GUI: VNC and the Client-Server Reversal of the X Window System
    • 5.Week 10 Comprehensive Review: Tying Network Services Together on One Port Sheet
  • Week 11
  • Week 12
  • Week 13
  • Week 14
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← Linux Master 1/Week 10/Day 1

Based on the Linux Master 1 exam syllabus·Report an error

Linux Master 1· AssociateWeek 10 · Day 1~22 min read

Day 1 - Mail Services: The MTA, MDA, MUA and SMTP, POP3, IMAP Triangle

📌 Key Takeaways

  • The mail system has an asymmetric structure: "SMTP to send, POP3/IMAP to retrieve." Once you can sketch this asymmetry, the ports and config files fall into place.
  • Division of roles: MUA (user client) → MTA (server-to-server transfer) → MDA (final delivery to the mailbox).
  • Ports to answer instantly: SMTP 25 · POP3 110 · IMAP 143, and the encrypted ones: SMTPS 465 · Submission 587 · IMAPS 993 · POP3S 995.
  • POP3 downloads and deletes from the server (single device), IMAP keeps mail on the server and syncs (multiple devices). "Multiple devices = IMAP".
  • The MTAs are Sendmail (legacy, /etc/mail/sendmail.cf) and Postfix (modular, secure, /etc/postfix/main.cf). Opening mynetworks too wide creates an open relay.

The 3 Components of a Mail System — MTA, MDA, MUA

  • Mail isn't exchanged directly by people; it is delivered by a relay of three programs with separate roles.
ComponentFull nameRoleTypical programs
MUAMail User AgentClient where the user writes and reads mailOutlook, Thunderbird, mutt, mail
MTAMail Transfer AgentCore engine that transfers (routes) mail between serversSendmail, Postfix, Exim
MDAMail Delivery AgentMakes the final delivery of mail received by the MTA to the user's mailboxProcmail, Dovecot's LDA, mail.local
  • Drawn in one line, the flow looks like this.
[Sender MUA] --SMTP--> [Sending MTA] --SMTP--> [Receiving MTA] --MDA--> [Mailbox]
                                                              ↑
                          [Recipient MUA] <--POP3/IMAP-- [Mailbox]

The MTA is "the truck hauling between post offices," the MDA is "the mail carrier dropping letters into the mailbox," and the MUA is "a person writing and reading letters." MTAs talk to each other over SMTP, the MDA drops the mail into the mailbox, and then the MUA looks into that mailbox over POP3/IMAP. This division of labor is the backbone of the mail architecture.

Key distinction: MTA and MDA are different stages. The MTA is the transfer stage that moves mail from server to server, while the MDA is the final delivery stage that drops that mail into the local user's mailbox. SMTP is the language of the MTA; POP3/IMAP are the language of the MUA that reads the mailbox.

Mail Protocols and Ports — The Asymmetry of Sending and Receiving

  • This is what the practical exam asks about. You must memorize the port numbers outright.
ProtocolDirectionPlaintext portEncrypted (SSL/TLS) port
SMTPSending (MUA→MTA, MTA→MTA)25465 (SMTPS), 587 (STARTTLS submission)
POP3Receiving (server→MUA, download)110995 (POP3S)
IMAPReceiving (server→MUA, kept on server)143993 (IMAPS)

Points to lock into memory:

  • Sending = SMTP = 25, secure sending = 465 / 587
  • POP3 = 110 → 995, IMAP = 143 → 993 (memorizing both by their ending-digit pattern is safe)
  • 25 is the standard for relaying between MTAs, 587 is the authenticated port where users "submit" mail

⚠️ Trap: Some questions mix up 465 and 587. 465 is SMTPS, which wraps the connection in SSL from the start; 587 is the mail submission port that starts in plaintext and is encrypted via STARTTLS. Also, a choice that flips the direction to "receiving = 110/143, sending = 25" is wrong. A choice that attaches 25 to POP3 is wrong as well.

Key distinction: POP3 vs IMAP — POP3 downloads mail to the client and deletes it from the server (by default), so it suits use on a single device. IMAP leaves mail on the server and syncs, so it suits viewing the same mailbox from multiple devices. "Syncing across multiple devices = IMAP" is the signal for the correct answer.

Try It Yourself — Checking Ports and Services

# Check whether the mail-related ports are LISTENing
ss -tlnp | grep -E ':(25|110|143|465|587|993|995)'
 
# Check the standard port definitions in /etc/services
grep -E '^(smtp|pop3|imap|submission|imaps|pop3s)\b' /etc/services
 
# Local mail delivery test (SMTP conversation via telnet)
telnet localhost 25
# Response: 220 mail.example.com ESMTP Postfix

SMTP uses port 25 because it is a historical number assigned back in 1982 in RFC 821. Later, as ISPs blocked outbound port 25 to stop spam, port 587 (RFC 4409) was split off for authenticated users to submit mail. That is why a large share of today's "mail goes out but I can only receive" outages are caused by port 25 being blocked.

Sendmail vs Postfix — The Showdown of Two MTAs

  • Linux's two representative MTAs are the traditional Sendmail and the modern Postfix.
  • The exam asks about the differences between the two and their config file locations.
ItemSendmailPostfix
Released1983, the oldest MTA1998, developed with security and simplicity as goals
ArchitectureOne huge monolithic processSplit into several small processes (modular)
Config file/etc/mail/sendmail.cf (generated with m4)/etc/postfix/main.cf (intuitive)
Config difficultyVery complex (.mc → .cf compile)Relatively easy (key=value)
SecurityWeak privilege separation (many historical vulnerabilities)Strong security through privilege separation
Current standingLegacyDe facto standard, the RHEL default

Postfix replaced Sendmail because "one huge process" was the weak point for security. Postfix splits receiving, queueing, and delivery into small processes with different privileges, designed so that a breach in one part doesn't spread to the whole. "Security and modular = Postfix" is the key.

Postfix main.cf Key Directives

# /etc/postfix/main.cf — key settings
myhostname = mail.example.com      # This server's hostname
mydomain = example.com             # Domain name
myorigin = $mydomain               # Domain for outgoing mail (fixes up the sender address)
inet_interfaces = all              # Interfaces to listen on (all = every NIC)
mydestination = $myhostname, localhost, $mydomain   # Domains treated as local delivery
mynetworks = 127.0.0.0/8, 192.168.0.0/24            # Trusted networks allowed to relay
relayhost = [smtp.isp.com]:587     # Relay server that outbound mail goes through
home_mailbox = Maildir/            # Mailbox format (Maildir/ vs mbox)
  • After changing the configuration, it must be reloaded.
postconf -n                # Print only settings that differ from the defaults (for checking)
postfix check              # Check config syntax
systemctl reload postfix   # Apply config changes without downtime
newaliases                 # Rebuild the DB after changing /etc/aliases

⚠️ Trap: If you set inet_interfaces to localhost, the server can't receive mail from outside. Also, if you open the mynetworks range too wide (e.g., 0.0.0.0/0), anyone can relay mail through this server, making it an open relay that gets abused as a spam source. They pair up as "can't receive = inet_interfaces, open relay risk = mynetworks".

Key distinction: Mailbox storage format mbox vs Maildir — mbox appends all mail into a single file, so lock conflicts are frequent, while Maildir stores each message as one file in a directory, which is safe for concurrent access. A value ending in a slash (/), like home_mailbox = Maildir/, is the signal for Maildir format.

Mail Aliases and Queue Management

# /etc/aliases — redirect recipient addresses (aliases)
root:       admin@example.com    # Forward mail addressed to root to admin
webmaster:  root                 # Multi-level aliases are also possible
# After editing, always run
newaliases
 
# Check and handle the mail queue
mailq              # Show the pending mail queue (same as postqueue -p)
postqueue -f       # Flush the queue immediately (try resending)
postsuper -d ALL   # Delete all mail in the queue

It is common for mail not to go out right away and pile up in the queue. Because of a temporary outage on the receiving server, a DNS MX lookup failure, greylisting, and so on, the MTA doesn't discard the mail but keeps it in the queue and retries periodically. So when a report comes in that "mail is delayed," the first thing to do is check the queue state with mailq. This is the mail administrator's first diagnostic command.

Pre-Exam Checklist

  • Answer instantly: 25 (SMTP), 110 (POP3), 143 (IMAP), 465 (SMTPS), 587 (submission), 993 (IMAPS), 995 (POP3S)
  • MTA (server-to-server transfer) ≠ MDA (mailbox delivery) ≠ MUA (user client)
  • Postfix config is /etc/postfix/main.cf, Sendmail's is /etc/mail/sendmail.cf
  • POP3 = download then delete, IMAP = keep on server and sync
  • To prevent an open relay, keep mynetworks narrow

📖 Glossary

  • MUA (Mail User Agent) : The client where people write and read mail. Outlook, Thunderbird, mutt, etc.
  • MTA (Mail Transfer Agent) : The transfer engine that moves mail from server to server. Sendmail and Postfix are the typical ones.
  • MDA (Mail Delivery Agent) : Handles the final delivery, dropping mail the MTA has received into the local user's mailbox.
  • SMTP : The protocol for sending mail. Both MUA→MTA and MTA→MTA use it.
  • submission (587) : The dedicated port where users submit mail after authenticating. Encrypted with STARTTLS.
  • SMTPS (465) : A sending port that connects wrapped in SSL from the start. Easy to confuse with 587.
  • POP3 vs IMAP : Download-and-delete-from-server (single device) / keep-on-server-and-sync (multiple devices).
  • inet_interfaces : The interfaces on which Postfix receives mail. If set to localhost, it can't receive outside mail.
  • mynetworks : The trusted networks allowed to relay. Too wide makes an open relay.
  • Open relay : A state where anyone can relay mail through this server. Abused as a spam source.
  • relayhost : Specifies the relay server that outbound mail passes through instead of being sent directly.
  • mbox vs Maildir : Appending all mail into one file / storing each message as one file (safe for concurrent access).
  • /etc/aliases : The alias file that forwards a recipient address to another address. After editing, you must rebuild the DB with newaliases.
  • Mail queue : Where mail that couldn't be sent immediately piles up awaiting retry. View it with mailq and push it out with postqueue -f.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Which component in a mail system is responsible for transferring (routing) mail between servers?

Question 2

Which option correctly pairs the default (plaintext) port numbers of SMTP, POP3, and IMAP, in order?

Question 3

Which statement about the difference between POP3 and IMAP is correct?

Question 4

Which is the correct path of Postfix's main configuration file?

Question 5

Which option correctly pairs the port used to send mail encrypted with SSL/TLS (SMTPS) and the IMAP encrypted port (IMAPS)?

Question 6

Which describes a characteristic of Postfix compared with Sendmail?

Question 7

What security problem occurs when mynetworks in Postfix is set excessively wide, such as 0.0.0.0/0?

PreviousDatabase Services: From Installing MySQL/MariaDB to Backup and RecoveryWeek 9 · Day 6Next File Transfer Services: FTP Active/Passive Modes and vsftpdWeek 10 · Day 2

Official references

  • Linux Master 1 official exam syllabus(opens in a new tab)

On this page

  • Key Takeaways
  • The 3 Components of a Mail System — MTA, MDA, MUA
  • Mail Protocols and Ports — The Asymmetry of Sending and Receiving
  • Try It Yourself — Checking Ports and Services
  • Sendmail vs Postfix — The Showdown of Two MTAs
  • Postfix main.cf Key Directives
  • Mail Aliases and Queue Management
  • Pre-Exam Checklist
  • Glossary
  • Practice Questions