FTP

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

FTP

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does FTP stand for and do?
A Fast Transmission Process: encrypts files as they travel across a network
B File Transfer Protocol: moves files between a client and a server
2. A student copies a website's files from their laptop to a web server. Which FTP action is this?
A Downloading
B Uploading
3. Which port does FTP use for its control connection by default?
A Port 21
B Port 443
4. Standard FTP is used to log in with a username and password. How are those logins sent?
A As plain text that an interceptor could read
B Encrypted so an interceptor sees only ciphertext
5. Which choice is the better way to transfer a file containing students' personal data?
A SFTP, because it encrypts the transfer
B Plain FTP, because port 21 is secure

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1PUT report.docx AGET photos.zip
2ftp.school.edu.au:21 BUploads a file from the client to the FTP server
3Downloading copies a file from the FTP server to the client CPlain FTP does not encrypt anything. Logins and files travel as plain text, so an interceptor could read them.
4A secure version of FTP that runs over SSH so data and logins are encrypted DFTP moves files between a client and a server. Web pages are sent by HTTP or HTTPS, not FTP.
5Use plain FTP on a public Wi-Fi network to send a login and password, because FTP encrypts everything. EConnects to an FTP server on its standard control port
6FTP is used to display web pages in a browser on port 21. Fsftp student@server.com

Definitions

FTP

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
___://files.school.edu.au/notes.txt
2.
ftp.connect("files.example.com", __)
3.
ftp._____("student", "pass123")
4.
ftp = _______("files.example.com")
5.
sftp student@files.example.com ___ report.pdf

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A from ftplib import SFTP
B ftp = FTP()
C ftp.connect("files.net", 21)
D ftp.login("sam", "pw123")
Question 2
A from ftplib import FTP
B ftp = FTP("files.net")
C ftp.login("sam", "pw123")
D ftp.cd("/reports")
E ftp.quit()
Question 3
A ftp.login("sam", "pw123")
B f = open("a.txt", "wb")
C cmd = "STOR a.txt"
D ftp.storbinary(cmd, f)
Question 4
A ftp.login("sam", "pw123")
B f = open("a.txt", "wb")
C cmd = "STOR a.txt"
D ftp.retrbinary(cmd, f.write)
Question 5
A HOST = "files.school.edu"
B PORT = 22
C ftp = FTP()
D ftp.connect(HOST, PORT)

Answer Key

FTP
Section A: Quick Questions
Q1
B — File Transfer Protocol: moves files between a client and a server
Q2
B — Uploading
Q3
A — Port 21
Q4
A — As plain text that an interceptor could read
Q5
A — SFTP, because it encrypts the transfer
Section B: Match the Pairs
Q1
PUT report.docx → Uploads a file from the client to the FTP server
Q2
ftp.school.edu.au:21 → Connects to an FTP server on its standard control port
Q3
Downloading copies a file from the FTP server to the client → GET photos.zip
Q4
A secure version of FTP that runs over SSH so data and logins are encrypted → sftp student@server.com
Q5
Use plain FTP on a public Wi-Fi network to send a login and password, because FTP encrypts everything. → Plain FTP does not encrypt anything. Logins and files travel as plain text, so an interceptor could read them.
Q6
FTP is used to display web pages in a browser on port 21. → FTP moves files between a client and a server. Web pages are sent by HTTP or HTTPS, not FTP.
Section C: Definitions
Q1
FTP — File Transfer Protocol: moves files between a client and a server (upload/download) on port 21. It sends data and logins as plain text, so use SFTP or FTPS for security.
Section D: Fill in the Blanks
Q1
ftp://files.school.edu.au/notes.txt
Q2
ftp.connect("files.example.com", 21)
Q3
ftp.login("student", "pass123")
Q4
ftp = FTP_TLS("files.example.com")
Q5
sftp student@files.example.com put report.pdf
Section E: Spot the Error
Q1
A — Python's ftplib module provides the FTP class (and FTP_TLS for the secure version). There is no SFTP class in ftplib, so the import should be 'from ftplib import FTP'.
Q2
D — The ftplib method for changing the working folder on the server is cwd(), not cd(). The line should be ftp.cwd("/reports").
Q3
B — Uploading means reading the local file and sending it to the server, so it must be opened in read-binary mode ("rb"). Mode "wb" would overwrite the file with nothing to send.
Q4
C — Downloading uses the RETR (retrieve) command with retrbinary(). STOR is the upload command, so the line should be cmd = "RETR a.txt".
Q5
B — FTP's control connection uses port 21. Port 22 is used by SFTP (which runs over SSH), so the line should be PORT = 21.