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 to understand ftp protocol

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

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

FTP is the English abbreviation of File Transfer Protocol (File transfer Protocol), while the Chinese abbreviation is "text transfer Protocol". Used for two-way transfer of control files on Internet. It is also an application (Application). Through it, users can connect their PC to all the servers running FTP protocol all over the world, and access a large number of programs and information on the server. The main function of FTP is to let users connect to a remote computer (where the FTP server program is running) to see what files are on the remote computer, and then copy the files from the remote computer to the local computer, or send the files from the local computer to the remote computer.

An example of how it works

To download files, for example, when you start FTP to copy files from a remote computer, you actually start two programs: a local FTP client program that requests the FTP server to copy the file. The other is the FTP server program that starts on the remote computer, which transmits the files you specify to your computer in response to your request. FTP adopts the "client / server" mode, and the client installs the FTP client program on its own local computer. There are two kinds of FTP client programs: character interface and graphical interface. The commands of FTP in character interface are complex and numerous. Graphical interface of the FTP client program, the operation is much more concise and convenient.

File transfer protocol

In a nutshell, the server that supports the FTP protocol is the FTP server. Let's introduce what the FTP protocol is. (file transfer Protocol)

Generally speaking, the primary purpose of using the Internet is to achieve information sharing, and file transfer is one of the very important contents of information sharing. It is not easy to transfer files on Internet in the early days. We know that Internet is a very complex computer environment, with PC, workstations, MAC, mainframes, and tens of millions of computers connected to Internet, and these computers may run different operating systems, servers running Unix, PCs running Dos and Windows, Macs running MacOS, and so on. The problem of file exchange between various operating systems requires the establishment of a unified file transfer protocol, which is called FTP. There are different FTP applications based on different operating systems, and all of these applications follow the same protocol so that users can transfer their own files to others or obtain files from other user environments.

Server system

Like most Internet services, FTP is a client / server system. The user connects to the FTP server program on the remote host through a client program that supports the FTP protocol. The user issues a command to the server program through the client program, and the server program executes the command issued by the user and returns the result of the execution to the client. For example, a user issues a command that requires the server to send a copy of a file to the user, and the server responds to this command by sending the specified file to the user's machine. The client program receives this file on behalf of the user and stores it in the user directory.

In the use of FTP, users often encounter two concepts: "Download" and "Upload". To "download" a file is to copy a file from a remote host to your own computer, and to "upload" a file is to copy a file from your own computer to a remote host. In the Internet language, users can upload (download) files to (from) a remote host through a client program.

When using FTP, you must first log in and obtain the appropriate permissions on the remote host before you can download or upload files. In other words, if you want to transfer files with which computer, you must have the appropriate authorization of which computer. In other words, the file cannot be transferred unless you have a user ID and password. This situation violates the openness of Internet. There are more than 10 million FTP hosts on Internet, and it is impossible to require every user to have an account on every host. Anonymous FTP is created to solve this problem.

Anonymous FTP is a mechanism through which users can connect to a remote host and download files from them without having to become their registered users. The system administrator has established a special user ID called anonymous, which can be used anywhere by anyone on the Internet.

The way to connect an anonymous FTP host through a FTP program is similar to that of an ordinary FTP host, except that you must enter anonymous when you are asked to provide a user ID ID, and the password of the user ID can be any string. It is customary to use your own E-mail address as a password to enable system maintenance programs to record who is accessing these files.

It is worth noting that anonymous FTP does not apply to all Internet hosts, it only applies to those hosts that provide this service.

When a remote host provides an anonymous FTP service, it specifies that certain directories are open to the public, allowing anonymous access. The rest of the directory in the system is hidden. As a security measure, most anonymous FTP hosts allow users to download files from them without uploading files to them, that is, users can copy all files on anonymous FTP hosts to their machines, but not any files on their machines to anonymous FTP hosts. Even if some anonymous FTP hosts do allow users to upload files, users can only upload files to a specified upload directory. The system administrator then checks the files and moves them to another public download directory for other users to download. In this way, users of the remote host are protected from uploading problematic files, such as files with viruses.

As an Internet user, you can copy files between any two Internet hosts through FTP. However, in fact, most people have only one Internet account, and FTP is mainly used to download public files, such as shareware, company technical support files, and so on. There are thousands of anonymous FTP hosts on Internet, which hold countless files for users to copy for free. In fact, almost all types of information and all types of computer programs can be found on Internet. This is one of the important reasons why Internet attracts us.

Anonymous ftp

Anonymous FTP users have access to the world's largest repository of information, which is cumulative and growing, never shutting down, covering almost all topics. And it's all free.

Anonymous FTP is a common method of publishing software on Internet. Internet continues today because people use programs that provide standard services through standard protocols. Many programs like this are published via anonymous FTP and can be accessed by anyone.

There are a large number of anonymous FTP hosts and more files in Internet, so how exactly do you know which directory on which anonymous FTP host a particular file is located? This is exactly what the Archie server is going to do. Archie will automatically search the FTP host to construct a database containing all the file directory information, so that you can directly find the location information of the files you need.

User classification and authority attribution of FTP to Real account

This type of user means having an account on the FTP service. When such users log in to the FTP server, their default home directory is the directory named by their account. However, it can also be changed to other directories. Such as the home directory of the system and so on.

Guest user

In FTP servers, we tend to set up an account for different departments or for a specific user. However, a feature of this account is that it can only access its own home directory. The server secures other files on the FTP service in this way. This kind of account is called Guest user in Vsftpd software. Accounts with such users can only access directories under their home directory, not files outside their home directory.

Anonymous (anonymous) user

This is what we usually call anonymous access. This type of user means that no account is specified in the FTP server, but they can still access certain public resources anonymously.

When building a FTP server, we need to classify users according to their type. By default, the Vsftpd server assigns all established accounts to Real users. However, this often does not meet the needs of enterprise security. Because such users can access not only their own home directories, but also other users' directories. This brings certain security risks to the space where other users are located. Therefore, enterprises should modify the category of users according to the actual situation. [1]

FTP client

Ftp client. The volume can be said to be the smallest, only 330K, the free Chinese version does not need to be Chinese and cracked. The function is also very powerful, everything. It can support multithreaded upload and decompress directly in space after uploading compressed packages directly.

8uftp is a very incisive ftp client. Currently the smallest FTP client tool.

Free Chinese version for life, non-Chinese version, non-cracked version.

Covers other FTP tool features

Exclusive support for multithreaded upload, making the upload speed faster and more stable.

At the same time, it supports uploading compressed packages directly, which can be decompressed directly in space. You can also download the package directly after being compressed in space.

8uftp 2.6 upgrade function

1. Add replication URL function of remote ftp directory

two。 Add tools for comparing remote ftp directories with local directories

General steps for transferring files through FTP Command prompt

Computers that require remote file transfers must install and run the ftp client program. During the installation of the windows operating system, the tcp/ip protocol software is usually installed, including the ftp client program. However, the program is a character interface rather than a graphical interface, which must be operated at a command prompt, which is very inconvenient.

Another way to start the ftp client program is to use an ie browser. Users only need to enter the url address in the ie address bar as follows: ftp:// [user name: password @] ftp server domain name [: Port number]

(you can also use the above method to connect under the CMD command line, upload and download through the put command and get command, and list the directory through the ls command. In addition to the above method, you can also enter ftp enter under cmd, and then enter open IP to establish a connection. This method is also suitable for connecting to the ftp server under linux)

The method of launching ftp through an ie browser, while available, is slow and insecure by exposing passwords to ie browsers. Therefore, it is common to install and run specialized ftp clients.

1. Log in to the Internet on your local computer.

two。 Search for a file sharing host or personal computer (usually posted on a dedicated FTP server website with the name, password and path of access to the host or personal computer).

3. After establishing a connection with the remote host or the other party's personal computer, log in to the host or the other party's personal computer with the user name and password provided by the other party.

4. After logging in to the remote host or the other person's PC, you can upload what you want to share with others or download what they are authorized to share (here is something that can be put on the computer and can be seen on the screen).

5. After finishing the work, close the FTP download software and cut off the connection.

In order to achieve file transfer, users have to run special file transfer programs, such as Internet Express has this function, there are many other special FTP transfer software, FlashFxp is one of the outstanding software. Interested netizens can try other software, such as LeapFTP, each has its own characteristics.

FTP protocol

In the TCP/IP protocol, the FTP standard command TCP port number is 21 Magi Port mode data port is 20. The task of the FTP protocol is to transfer files from one computer to another, regardless of where the two computers are located, how they are connected, or even whether they use the same operating system. Assuming that two computers talk through the ftp protocol and can access Internet, you can use the ftp command to transfer files. There are some nuances in the use of each operating system, but the basic command structure of each protocol is the same.

There are two ways of FTP transmission: ASCII transmission mode and binary data transmission mode.

1.ASCII transfer mode: assuming that the file you are copying contains simple ASCII text, if you are not running UNIX on a remote machine, ftp will usually automatically adjust the contents of the file when the file is transferred in order to interpret the file into the format in which the text file is stored on another computer.

However, it is often the case that the file the user is transferring does not contain text files, but may be programs, databases, word processing files, or compressed files (although word processing files contain most of the text, it also contains non-print characters that indicate page size, font, and other information). Before copying any non-text files, use the binary command to tell ftp to copy verbatim and not to process these files, which is also the binary transfer I'll talk about below.

2. Binary transfer mode: in a binary transfer, the bit order of the file is saved so that the original and copied correspond bit by bit. Even a file that contains a sequence of bits on the destination machine is meaningless. For example, macintosh sends an executable file to the Windows system in binary form, which cannot be executed on the other system.

If you transfer binaries in ASCII mode, they will be translated even if you don't need them. This slows down the transfer slightly, corrupts the data and makes the file unusable. On most computers, the ASCII approach generally assumes that the first significant bit of each character is meaningless because it is not used in ASCII character combinations. If you transfer binaries, all bits are important. If you know that the two machines are the same, binary is valid for both text files and data files.

5. The way FTP works

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

Here is a description of how these two ways work:

The Port mode FTP client first establishes a connection with the TCP 21 port of the FTP server, 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 connects to the designated port of the client through its own TCP 20 port to send data. FTP server must establish a new connection with the client to transfer data.

Passive mode is similar to Standard mode when establishing a control channel, but instead of a Port command, a Pasv command is sent after the connection is established. After the FTP server receives the Pasv command, it randomly opens a temporary port (also called free port, port number is greater than 1023 and less than 65535) and notifies the client to send data on this port. The client connects to the FTP server this port, and then the FTP server will transmit data through this port. At this time, FTP server no longer needs to establish a new connection with the client.

Many firewalls are not allowed to accept externally initiated connections when they are set up, so many FTP servers located behind firewalls or intranets do not support PASV mode because clients cannot open high-end ports of FTP servers through firewalls. However, many clients of the intranet can not log in to the PORT server because the TCP 20 of the server cannot establish a new connection with the client of the internal network, which makes it unable to work.

FTP software can better help you manage FTP directories and provide more systematic tools.

Cuteftp is recommended for FTP tools.

Active and passive modes there are two usage modes for FTP: active and passive. Active mode requires both the client and the server to open and listen on a port at the same time to establish a connection. In this case, the client will have some problems due to the installation of the firewall. Therefore, the passive mode is created. Passive mode only requires the server to generate a process that listens on the corresponding port, thus bypassing the problem that the client has a firewall installed.

The following steps are followed for an active mode FTP connection establishment:

The client opens a random port (the port number is greater than 1024, in this case, we call it x), while a FTP process connects to the server's command port 21. At this point, the source port is random port x, on the client, the remote port is 21, and on the server.

The client starts listening on the port (xroom1) and sends a port command to the server (through the server's command port 21), which tells the server the port number the client is listening on and is ready to receive data from this port. This port is what we know as a data port.

The server opens source port 20 and establishes a connection to the client data port. At this point, the source port is 20 and the remote data port is (xroom1).

The client establishes a connection to the server port 20 through the local data port, and then sends a reply to the server telling the server that it has established a connection.

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