01-FTP
FTP features
FTP session (stateful).
FTP is comparatively simple.
FTP is better suited (faster,more efficient) for large files.
FTP has a control and a data connection and communicates TCP port numbers for data connection in control connection (so-called ‚non-well-behaving‘ protocol).
…
FTP uses a TCP control and data connection.
The TCP control connection is used for opening / closing an FTP session and for transferring commands from client to server.
The data connection is used for transferring individual files between client and server.
Every file transfer uses a separate data connection.
active mode procedure
1. Open control connection
The Client opens a control connection to the server (TCP).
This control connection (<font color=901ff size=5 face="΢ÈíÑźÚ"> server port 21</font>, the client uses an <font color=901ff size=5 face="΢ÈíÑźÚ"> ephemeral port</font>) is used for FTP commands (C>S) and FTP replies (S<C).
2. File transfer command
The client initiates a file transfer (C>S: STOR, S<C: RETR).
3. Data connection for transfer
A new data connection (TCP, usually <font color=901ff size=5 face="΢ÈíÑźÚ"> server port 20</font>, the client uses an <font color=901ff size=5 face="΢ÈíÑźÚ"> ephemeral port</font>) is created for the transfer of the file. In <font color=ff0199 size=5 face="΢ÈíÑźÚ">active mode</font> (see below), this connection is opened by the server (for RETR and STOR operations).
4. End of file transfer
The sender (server for RETR operation, client for STOR operation) closes the data TCP
connection when the file is completely transferred.
5. Close control connection
At the end of the FTP session, the client closes the control connection.
主動模式中,數據傳輸階段client 端口由client 決定,server 端口爲 20
passive mode procedure
- client server TCP shakehand
- client send PASV command
- server determine ephemeral port and make connection with client(ephemeral port)
- transfer data
- end of file transfer
- close control connection
被動模式中,數據傳輸階段client 端口隨機,server 端口隨機
常見FTP server client
常見FTP服務器
IIS、Serv-U Filezilla //windows
wu-ftpd、Proftpd //proftpd
vsftpd(Very Secure FTP Daemon)
常見FTP客戶端
ftp命令 ie chrome
CuteFTP、FlashFXP、LeapFTP、Filezilla
gftp、kuftp