FTP and SFTP
FTP and its two connections, active and passive modes, the commands and the reply-code families, the clear-text password; FTPS, and SFTP which goes through SSH on a single connection.
- 34 cards
- 6 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- On the diagram
- Scenarios
- Understand
A few cards from the deck
FTP: what is it?
Show the answer
A file transfer protocol that uses two TCP connections: one for commands (port 21), another opened for each transfer to carry the data.
Everything travels in the clear, login and password included:
PASS secret123can be read verbatim on the network. That is why FTPS or SFTP are preferred today.In this session, on which port does the client open the data connection?
```text
220 (vsFTPd 3.0.5)
USER alice
331 Please specify the password.
PASS secret123
230 Login successful.
PASV
227 Entering Passive Mode (192,168,1,20,195,80).
LIST
150 Here comes the directory listing.
226 Directory send OK.
QUIT
221 Goodbye.`- 50000
- 21
- 20
- 195
Show the answer
50000
The port is read from the last two numbers of the 227 reply: 195 × 256 + 80 = 50000. 21 is the command port, 20 the port the server would open from in active mode.
An FTP server listens for commands on port …; files and listings go through a separate … connection.
Show the answer
An FTP server listens for commands on port 21; files and listings go through a separate data connection.
The commands (
USER,PASS,LIST,RETR,STOR) stay on the first connection for the whole transfer. That is why a firewall that opens only port 21 lets the connection through but blocks the transfers.Active mode: what is it?
Show the answer
A mode where the client gives its address and a port with the
PORTcommand, then the server itself opens the data connection towards the client.The server starts “knocking” at the client's door: a NAT or a firewall on the client side blocks that incoming connection, and the transfer fails.