Cyberlium

Networking › Module 3 › Lesson 3

BeginnerModule 3Lesson 3/5

FTP, SSH, SMTP, IMAP

Common application protocols, ports, and security notes

15 min+41 XP3 quiz
Module progress3 of 5

Opening

Not every conversation is a web page

HTTP/HTTPS dominate screenshots. Logs and firewalls are full of other dialects: file transfer, remote shells, mail submission, mailbox sync. Each dialect has a default port, a cleartext vintage, and a modern encrypted replacement. Defenders who only memorize 80 and 443 misread SSH brute force as "web," treat FTP as "just files," and cannot explain why mail still speaks SMTP in 2026. This lesson is mechanism and hygiene on your own box: what the protocol was built to do, why the old port is a postcard, what to prefer, and how ss -tuln shows whether you are even listening. No exploit payloads. No scanning anyone else.

1. FTP 21 is a postcard; SFTP rides SSH 22

FTP (File Transfer Protocol) predates casual encryption. Control conventionally listens on TCP/21. Commands such as USER and PASS, and often the files themselves, travel as readable text on the path — the same class of failure as HTTP/80. FTP also splits control and data into separate connections (active vs passive), which is why FTP is a firewall headache: extra ports, extra state, extra ways to get it wrong. You do not need a steal-the-password script to understand the risk. If the bytes are cleartext, an observer on a path you should not be observing could read them. In this course you will not capture other people's FTP, will not write attack tooling, and will not "practice" against random FTP banners on the internet. SFTP is not "FTP with an S slapped on." SFTP is a file protocol inside an SSH session, typically TCP/22. FTPS (FTP plus TLS) exists too, still with FTP's dual-connection awkwardness. When a modern runbook says "put the file on the box," the default should be scp/sftp over SSH keys, not a 1990s FTP daemon with a password.

2. SSH 22: encrypted remote control — keys never leave the machine

SSH (Secure Shell) encrypts remote login, remote commands, and tunneled file copy. Port 22/TCP is the well-known listener. The confidentiality win versus telnet/FTP is the point of the protocol: the path sees ciphertext. The remaining failures are human and operational: password auth facing the whole internet, reused credentials, and private keys treated like chat snippets. A key pair is two files. The public key is a lock you may copy to a server's authorized_keys. The private key is the unique cut; mode 600; never pasted into Slack, tickets, or a lesson chat. Anyone with that file is you. Host key verification (known_hosts) still matters: a changed fingerprint is a stop sign, not a yes-spam. Only connect to systems you own or have written permission to administer. A listening 22 on 0.0.0.0 is a door to the LAN and beyond; 127.0.0.1:22 would be a local-only door — rare, but the bind address is the first fact.

3. SMTP still moves mail; IMAP is how you read a mailbox

Email is two jobs that people smash together. SMTP (Simple Mail Transfer Protocol) injects and relays messages between mail systems. IMAP (and POP3) is how a client reads and organizes a mailbox that already exists. You cannot delete SMTP from the universe by using a webmail UI: when you send to a friend at another domain, some SMTP conversation still happens between servers. That is why mail still uses SMTP. Port 25/TCP is classic server-to-server relay. Many consumer ISPs block outbound 25 to cut spam. Port 587/TCP is submission: a person (or app) authenticates to their provider and hands over a message, usually with STARTTLS. Port 465 is SMTPS (implicit TLS) on some providers. Open relays — servers that forward mail from strangers — are how 25 became a spam cannon. SPF, DKIM, and DMARC are receiver-side checks on "who is allowed to send as this domain." They are not IMAP features.

IMAP keeps mail on the server and syncs folders across devices. Port 143/TCP is historically cleartext IMAP (LOGIN as readable as FTP USER/PASS). Port 993/TCP is IMAPS — IMAP over TLS. Prefer 993. POP3 (110/995) downloads to one device; you will see it in old tickets. A mailbox password on 143 is another postcard. Encrypted ports do not remove phishing: SMTP will still happily relay a convincing message. Protocol encryption and message authenticity are different layers — same lesson as HTTPS vs "the site is honest."

4. Wrong vs right: cleartext daemons and pasteable keys

Worked failure mode — standing up vintage services and leaking the only secret that matters. Inventory is ss on YOUR machine. No nmap of other hosts.

  • Wrong

    You enable anonymous FTP on 0.0.0.0 because a 2008 tutorial said so. You paste ~/.ssh/id_ed25519 into a group chat "so the intern can deploy." You scan the school /24 for port 21 "to find FTP to practice on." You send a mailbox password to IMAP/143 on café Wi-Fi and call it fine because "email is old."

  • Right

    Prefer SFTP/SSH over FTP; 587/993 (or other TLS submission/IMAP) over 25/143 for client mail. Private keys stay on disk at 600. ss -tuln on your VM: note 21, 22, 25, 143, 587, 993 if present, and whether they bind 127.0.0.1 or 0.0.0.0. Optional: curl -I https://example.com — still your client, still not a port scan.

5. Practical: list YOUR listeners; do not probe the LAN

ss -tuln is local socket inventory. -t TCP, -u UDP, -l listening, -n numeric (no extra DNS lookups). You are reading your kernel's table. That is not nmap. You will not target other IPs. If you see :22 or :80, ask: which address? *:22 or 0.0.0.0:22 is all IPv4 interfaces; 127.0.0.1 is this host only. curl -I is optional header hygiene from the last lesson — still example.com or a host you own.

ss -tuln on your VM/WSL — localhost inventory only

# Listening TCP/UDP on THIS machine (not a network scan)
ss -tuln

# Easier to read: only LISTEN lines
ss -tuln | grep -E 'LISTEN|udp'

# Optional notes — your home directory, mode 600
mkdir -p "$HOME/cyberlium-lab"
ss -tuln > "$HOME/cyberlium-lab/app-protocol-ports.txt"
chmod 600 "$HOME/cyberlium-lab/app-protocol-ports.txt"

# Optional: header check from the previous lesson (your client)
curl -I https://example.com | head -n 20

# Private keys: list names, never print contents
ls -l "$HOME/.ssh" 2>/dev/null || echo 'no ~/.ssh yet — that is OK'
# NEVER: cat id_ed25519  or  paste a private key into chat/tickets

# NEVER: nmap, masscan, or nc to other LAN hosts
# NEVER: stand up FTP "to capture passwords" — no exploit payloads in this course
# NEVER: connect SSH to a box you noticed in someone else's ARP table

Mission: map 21/22/25/143/587/993 on your own ss output

On your own VM or WSL, run ss -tuln. In $HOME/cyberlium-lab/app-protocol-ports.txt, highlight any listeners on 21, 22, 25, 143, 587, 993, 80, or 443. For each, write bind address (127.0.0.1 vs 0.0.0.0/*) and one security note (e.g. "FTP 21 would be cleartext — I should not enable it"). Do not nmap other hosts. Do not paste private keys. Optional: curl -I https://example.com.

Stuck? Ask Cyberlium AI Mentor

If ss -tuln is empty or you cannot tell 127.0.0.1 from *:22, ask Cyberlium AI Mentor for a hint — not an nmap one-liner. Try: "Hint only: ss shows *:22 versus 127.0.0.1:22 — which one is reachable from the LAN, and why is that the first question after seeing SSH?"

You can separate FTP's cleartext control channel from SFTP-over-SSH, treat 22 as encrypted remote control that still dies if the private key leaks, and explain why SMTP remains the inter-domain mail truck while IMAPS (993) is how a client reads a mailbox. Next — Lab — Wireshark Packet Analysis — you will capture only your own interface or loopback and watch DNS, TLS, and HTTP as packets, never a café full of strangers.

Knowledge Check

1

APPLY: A vendor wants you to upload logs with USER/PASS on tcp/21. You offer SFTP instead. What risk are you refusing, conceptually?

Multiple choice

Knowledge Check

2

APPLY: A teammate pastes id_ed25519 into chat so you can "finish the SMTP cutover." Mail ports are 587 and 993. What is the correct stop?

Multiple choice

Knowledge Check

3

APPLY: True or False: SMTP still exists because independently operated domains must relay messages to each other; IMAP (143/993) is how a client reads a mailbox, not a replacement for that relay.

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)