Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does FTP work?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How FTP works, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

How FTP works

File transfer protocol: one of the three early application-level protocols of File Transfer Protocol, based on the Cpact S structure data transfer format: binary (default) and text dual-channel protocol: command and data connection

Two modes: from a server point of view

Active (PORT style): server active connection command (control): client: random port-> server: 21/tcp data: client: random port server: 21/tcp data: client: random port-> server: random port / tcp

There is a special client and a special server based on the Cpact S structure.

Dual channel protocol: command channel and data channel (the so-called dual channel means that FTP supports two ports)

Command channel: take port 21 of TCP to transmit instructions.

Data channel: used to transmit data

The command channel is always the client initiating a request to the server: the command channel always uses the TCP/21 port.

The data channel uses two ports, and the port is determined by the working mode:

Active mode (post) is port 20 of TCP.

The passive mode takes a random port, and the so-called active and passive are viewed from the role of the server.

Active mode (post): server-side active connection to client

Passive mode (pasv): the client actively connects to the server (will exchange information with each other through the command channel, and the client will know the random port number of the server)

Example: server passive mode data port 227 Entering Passive Mode

Analysis of the working principle of FTP dual Channel

FTP is a file transfer protocol that supports two modes, one is called Standard (Active, active), and the other is Passive (PASV, passive). The client of Standard mode (active mode) FTP sends PORT commands to FTP server. The client of the Passive mode (passive mode) FTP sends PASV commands to the FTP Server.

Command channel:

The client initiates a command request to the server, and the server opens the TCP/21 port number. The client initiates a three-way handshake request.

The server initiates the link from two ports. One of them is a port called a command channel, and one is a port that implements a data channel. The command channel is used to implement the execution of commands. The data port is used to realize data transmission, and the port of the command channel is a fixed TCP/21 port. If the client needs data transfer, the service opens the data channel port. The port of the data channel is not fixed, but the open port is judged according to the working mode.

Data channel:

Here is how this data channel works in two ways:

Active working mode (post): the server actively connects to the client

The FTP client first establishes a connection with FTP Server's TCP 21 port, sends commands through this channel, and sends PORT commands on this channel when the client needs to receive data. The PORT command contains what port the client uses to receive data. When transmitting data, the server sends data through TCP 20 port of its own data port. FTP server must establish a new connection with the client to transfer data.

Passive working mode (pasv): the client actively connects to the server (the client will exchange information with each other through the command channel, and the client will know the random port number of the server)

Similar to Standard mode when establishing a control channel, when the client sends PASV commands through this channel, FTP server opens a random port between 1024 and 5000 and notifies the client of the request to send data on this port, and then FTP server will transfer the data through this port. At this time, FTP server no longer needs to establish a new connection with the client.

FTP service status code: 1XX: message 125: data connection open 2XX: successful class status 200: command OK 230: login successful 3XX: supplementary class 331: user name OK 4XX: client error 425: unable to open data connection 5XX: server error 530: unable to log in

User authentication:

Anonymous user: ftp,anonymous, corresponding to Linux user ftp system user: Linux user, user / etc/passwd, password / etc/shadow virtual user: dedicated user for a specific service, independent user / password file.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report