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
  • Week 1
    • 1.Operating Systems and the Kernel: What Linux Does
    • 2.The Birth of Linux: From Unix to Linus
    • 3.Free Software and Open Source: What a License Decides
    • 4.Distributions: The Unit That Bundles the Kernel and Tools for Sale
    • 5.Week 1 Review: The Identity Behind the Name Linux
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
    • 1.The Web and Mail
    • 2.DNS: Names and Addresses
    • 3.Remote Access and File Transfer
    • 4.File Sharing and Old Internet Services
    • 5.Week 10 Review: Internet Services on One Page
  • Week 11
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
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 2/Week 10/Day 1

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

Linux Master 2· AssociateWeek 10 · Day 1~21 min read

Day 1 - The Web and Mail

📌 Key Takeaways

  • The web runs on HTTP (80), and the encrypted version is HTTPS (443).
  • The two leading Linux web servers are Apache and Nginx.
  • There are three mail protocols — SMTP (25) to send, POP3 (110) or IMAP (143) to receive.
  • Mail servers exchanging mail with each other also use SMTP. Exam questions test this point.
  • POP3 downloads and deletes; IMAP leaves mail on the server. If you use multiple devices, it is IMAP.

The Web

ItemDescription
WWWWorld Wide Web. Devised in 1989 by Tim Berners-Lee (CERN)
HTTPHyperText Transfer Protocol. Port 80
HTTPSHTTP + encryption (SSL/TLS). Port 443
HTMLA language for describing documents
URLAn address that indicates the location of a resource

Reading a URL

   https :// www.example.com : 443 /docs/index.html
     │            │             │        │
     │            │             │        └── Path
     │            │             └─────────── Port (default if omitted)
     │            └───────────────────────── Host name
     └────────────────────────────────────── Protocol (scheme)
  • If you omit the port, the scheme's default is used. http:// means 80 and https:// means 443. So https://www.example.com:443/ and https://www.example.com/ are the same address.
  • A server that uses a non-default port must have it written explicitly — http://192.168.0.10:8080/.
  • The scheme slot is not limited to http. It is where you state how to access the resource, as in ftp:// or mailto:.

What HTTP Exchanges

HTTP has a simple structure: the browser makes a request and the server sends a response. One request gets one response.

   [Request]   GET /docs/index.html HTTP/1.1
               Host: www.example.com
 
   [Response]  HTTP/1.1 200 OK
               Content-Type: text/html
 
               <html> … </html>
Request methodWhat it does
GETFetches a resource. Typing a URL into the address bar is this
POSTSends data. Submitting a login or post-writing form
HEADReceives only the headers, without the body
PUT / DELETEUploads a resource / deletes it
Status codeMeaningTypical
2xxSuccess200 OK
3xxRedirect to another address301, 302
4xxThe requester's (client's) fault403 Forbidden, 404 Not Found
5xxAn error on the server side500 Internal Server Error, 503 Service Unavailable
  • Just look at the first digit to know who is at fault. If it starts with 4, the request was wrong; if it starts with 5, the server is broken. 404 means "the server is fine, but there is no such document."
  • HTTP does not remember state (it is stateless). The server cannot tell whether the person who just made a request is the same as the one making a request now. The mechanism added to keep a login state going is the cookie.
  • HTTPS encrypts this whole conversation. The format of what is exchanged is the same as HTTP, with an SSL/TLS encryption layer inserted beneath it.

Web Servers and Browsers

CategoryNames
Web serverApache (the oldest standard), Nginx (light and fast), lighttpd
Graphical browserFirefox, Chrome, Konqueror (KDE)
Text browserLynx, w3m, links
  • Lynx is a text-based browser. It is used to view the web from the command line without a graphical environment. Its name shows up in the answer choices.
  • To download files from the command line, use wget or curl.
wget http://www.example.com/file.tar.gz      # Saves as file.tar.gz in the current directory
wget -c http://www.example.com/file.tar.gz   # Resumes an interrupted download
curl http://www.example.com/                 # Prints the received content to the screen (standard output)
curl -O http://www.example.com/file.tar.gz   # Saves under the original file name
  • wget defaults to "save to a file", while curl defaults to "print to the screen". To save with curl, give it -O (uppercase) or -o filename.
  • The daemon name of the Apache web server is httpd (on Debian-family systems it is apache2). The product name and the process name differ, which causes confusion when searching with ps.

A question asking you to pick "what is not a web browser" tests how program names are classified. It is mixed with the application programs we saw last week under X Window.

NameWhat it is
Firefox · Chrome · Chromium · OperaGraphical web browsers
KonquerorKDE's web browser and file manager
EpiphanyGNOME's web browser
Lynx · w3m · linksText web browsers
Thunderbird · EvolutionNot web browsers but mail programs
Apache · NginxNot browsers but web servers
  • Firefox and Thunderbird both come from Mozilla, but one is a browser and the other is a mail program.
  • Answer choices that swap server and client are also common. Apache is the side that serves documents, and Firefox is the side that receives and displays them.

The Three Mail Protocols

   [Sender]                                         [Recipient]
 
     Mail program                                    Mail program
          │                                              ▲
          │ SMTP                                  POP3 / IMAP
          ▼                                              │
     Outgoing mail server ──── SMTP ────► Incoming mail server ──┘
                        (server-to-server delivery is also SMTP)
ProtocolPortWhat it does
SMTP25Sends mail. Also handles server-to-server delivery
POP3110Downloads mail
IMAP143Views mail while keeping it on the server

"Which protocol exchanges mail between mail servers?" → SMTP. Receiving is POP3 and IMAP, but the key point is that what servers exchange with each other is SMTP.

  • Abbreviation expansions also come up — SMTP is Simple Mail Transfer Protocol, POP is Post Office Protocol, and IMAP is Internet Message Access Protocol.

The Path of One Email

This is the process of alice@example.com sending mail to bob@example.org.

   1  alice's mail program hands it to the example.com mail server           SMTP
   2  The example.com server asks DNS "where is example.org's mail server?"
   3  It delivers to the example.org mail server it found                    SMTP
   4  The example.org server puts it in bob's mailbox
   5  bob opens his mail program and fetches the mail from the mailbox   POP3 or IMAP
  • A mail address is user@domain. The domain after @ determines which server to send to, and the name before it determines whose mailbox on that server.
  • Steps 1 and 3 are both SMTP. Whether the user hands it to a server or a server hands it to another server, all the "pushing" is done by SMTP.
  • Only step 5 goes the other way. Mail does not arrive at bob's computer by itself. It waits in the mailbox on the server, and bob has to go and get it. This "fetching" is POP3 and IMAP.
  • Step 4 is why you can send mail even when the recipient's computer is off. The server receives and keeps it on their behalf.
If the sentence saysAnswer
Send mail, outgoing, transfer or exchange between serversSMTP
Fetch mail, delete from the server after downloadingPOP3
Read while keeping it on the server, multiple devices, folder syncIMAP
Attachments, non-English text, putting images in mailMIME

POP3 and IMAP

ItemPOP3IMAP
Where it is storedDownloaded to my computerStays on the server
Original on the serverUsually deletedKept
Multiple devicesNot synchronizedSame state on every device
OfflineGood for readingNeeds a connection
Port110143
  • To view the same mailbox on a phone and a PC, use IMAP. If the PC downloads it with POP3, it disappears from the phone.
  • The encrypted versions are POP3S (995) and IMAPS (993).
  • POP3's "delete" is only the default behavior. If you turn on "leave a copy on the server" in the mail program, you can keep it. Even so, it differs from IMAP in that read marks and folder organization remain only on that device.
  • IMAP keeps not just the mail body but also its state on the server. A mail read on the phone shows as read on the PC too, and deleting on one side removes it on the other.
ProtocolPlaintext portEncrypted port
HTTP80443 (HTTPS)
SMTP25465 (SMTPS)
POP3110995 (POP3S)
IMAP143993 (IMAPS)
  • The S at the end of the name is Secure. It is the same protocol with SSL/TLS encryption layered on, so it is assigned a separate port number.
  • Answer choices that swap 110 and 143 are the most common. Remember the three mail ports in the order 25 → 110 → 143 together with send → download → keep on server and view, in one line.

Components of a Mail System

AbbreviationFull nameWhat it doesExamples
MUAMail User AgentThe program the user works withThunderbird, Outlook, mutt
MTAMail Transfer AgentServer-to-server deliverySendmail, Postfix, qmail, exim
MDAMail Delivery AgentDelivers to the mailboxprocmail, Dovecot
   MUA ──► MTA ──── SMTP ────► MTA ──► MDA ──► Mailbox ──► MUA
   (Compose) (Send)            (Receive) (Deliver)        (Read)
  • U is User, T is Transfer, D is Delivery — look at the middle word to tell them apart.
  • Sendmail and Postfix being the leading MTAs is within the exam scope.
  • MIME (Multipurpose Internet Mail Extensions) is a specification that lets mail carry non-English text, images, and attachments. Originally, mail could only send English text.
  • MIME is not a protocol but a format for writing the content of mail. If a question puts it on a line with SMTP, POP3, and IMAP and asks "which is not a protocol that transfers mail," the answer is MIME.

Slotting Program Names into Roles

RolePrograms
MUA — programs the user reads and writes withThunderbird · Evolution · KMail · mutt · the mail command
MTA — server-to-server transfer (SMTP)Sendmail · Postfix · qmail · Exim
MDA — mailbox deliveryprocmail
POP3·IMAP server — lets the user fetch mailDovecot
  • Sendmail, Postfix, qmail, and Exim are all MTAs. Questions slip Thunderbird (an MUA) or Dovecot (the fetching side) in among them and ask you to pick "what is not an MTA."
  • Pairing protocols with roles: MTA ↔ SMTP, POP3·IMAP server ↔ POP3·IMAP. An MUA uses both: SMTP to send, POP3·IMAP to receive.
  • Depending on the book, Dovecot is grouped under MDA, or separated out as a server that lets users fetch mail. Either way, they agree that it is not an MTA.
  • A mailbox is a file on the server. Traditionally it accumulates in /var/spool/mail/username, and depending on the distribution the path may also appear as /var/mail.
SymptomWhere to look
Sending works but only receiving failsPOP3·IMAP settings (incoming server, 110·143)
Receiving works but only sending failsSMTP settings (outgoing server, 25)
Mail checked on the PC disappeared from the phoneThe PC downloaded it via POP3 and deleted it from the server
The web works but only https:// does notPort 443 is blocked

Tomorrow we cover DNS, which converts domain names to IPs.

📖 Glossary

  • HTTP / HTTPS : The web communication protocol / the web communication protocol with encryption applied. The ports are 80 and 443.
  • URL : The address of a resource, made up of protocol, host, port, and path.
  • Apache / Nginx : The most widely used web servers on Linux.
  • SMTP : The protocol that sends mail and relays it between servers. The port is 25.
  • POP3 : The protocol that downloads mail. The original on the server is usually deleted. The port is 110.
  • IMAP : The protocol that views mail while leaving it on the server. The port is 143.
  • MUA / MTA / MDA : The components responsible for the user program / server-to-server transfer / mailbox delivery.
  • MIME : An extension specification that lets mail carry non-English text and attachments.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Which protocol is used to exchange mail between mail servers?

Question 2

Which protocol lets you keep mail on the server and check it in the same state from multiple devices?

Question 3

What is the default port number used by HTTPS?

Question 4

Which component of a mail system is responsible for server-to-server mail transfer?

Question 5

Which of the following is a text-based web browser?

PreviousWeek 9 Review: The Network on One PageWeek 9 · Day 5Next DNS: Names and AddressesWeek 10 · Day 2

Official references

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

On this page

  • Key Takeaways
  • The Web
  • Reading a URL
  • What HTTP Exchanges
  • Web Servers and Browsers
  • The Three Mail Protocols
  • The Path of One Email
  • POP3 and IMAP
  • Components of a Mail System
  • Slotting Program Names into Roles
  • Glossary
  • Practice Questions