FTP protocol Detailed

Source: Internet
Author: User
Tags ftp commands ftp connection printable characters server website ftp client file transfer protocol ftp protocol

FTP is the abbreviation for file Transfer Protocol (document Transfer Protocol), and Chinese is called "Interfax protocol". Used for two-way transmission of control files on the Internet. At the same time, it is also an application (application). It allows users to connect their PC to all servers running the FTP protocol around the world, accessing a large number of programs and information on the server. The primary role of FTP is to have users connect to a remote computer (which is running an FTP server program) to see what files are on the remote computer, then copy the files from the remote computer to the local computer, or send the local computer's files to the remote computer. Working principle example of the following download file as an example, when you start FTP copy files from a remote computer, actually launched two programs: a local computer FTP client, it to the FTP server to make a request to copy files. The other is the FTP server program that launches on the remote computer, and it responds to your request to transfer the files you specified to your computer. FTP uses the client/Server "mode, the client wants to install FTP clients on its own local computer. The FTP client has two types: the character interface and the graphical interface. The ftp command of the character interface is complex and numerous. Graphical interface of the FTP client program, the operation to be concise and convenient more. File Transfer Protocol Simply put, the server that supports FTP protocol is the FTP server, the following describes what is the FTP protocol. (File Transfer Protocol) in general, the primary purpose of Internet is to realize information sharing, and file transfer is one of the important content of information sharing. The early implementation of the Internet on the transfer of files is not an easy thing, we know that the Internet is a very complex computer environment, with a PC, a workstation, a Mac, a mainframe, and connected to the Internet computer has tens of millions of stations, And these computers may run different operating systems, there are servers running UNIX, there are running DOS, Windows PC and Mac running MacOS and so on, and the various operating systems between the file Exchange problem, need to establish 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 files to others or get files from other user environments. Server systems like most Internet services, FTP is also 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 sends commands to the server program through the client program, the server executes the commands issued by the user, and returns the results of the execution to the client. For example, a user sends a command asking the server to send a copy of a file to the user, and the server responds to the command, sending the specified file to the user's machine.   The client program receives the file on behalf of the user and stores it in the user directory. In the use of FTP, users often encounter two concepts:"Download" (Download) and "Upload" (Upload). The "Download" file is the copy file from the remote host to your computer; "Upload"The file is the copy of the file from your computer to the 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 the file. That is, if you want to transfer files to the same computer, you must have the appropriate authorization for which computer. In other words, the file cannot be transferred unless there is a user ID and password. This situation violates the openness of the Internet, the FTP host on the internet is more than tens of millions, it is impossible to require each user to have an account on each host.   Anonymous FTP was created to solve this problem. Anonymous FTP is a mechanism by which a user can connect to a remote host and download files from it without becoming a registered user. The system administrator has established a special user ID named anonymous,anyone on the internet can use that user ID anywhere. The FTP program connects anonymous FTP hosts in much the same way as a normal FTP host, except that anonymous must be entered when a user ID is required, and the password for that userid can be any string. Accustomed to, with their own e-The mail address is used as a password to enable the system maintenance program to record who is accessing these files.   It is important to note that anonymous FTP does not apply to all Internet hosts, it only applies to those hosts that provide the service. When the remote host provides an anonymous FTP service, certain directories are specified to be open to the public, allowing anonymous access. The remaining directories in the system are in a stealth state. As a security measure, most anonymous FTP hosts allow users to download files from them without allowing users to upload files to them, which means that the user can copy all the files on the anonymous FTP host to their machine, but cannot copy any of the files on their machine to an anonymous FTP host. Even if some anonymous FTP hosts do allow users to upload files, users can only upload files to a specified upload directory.   Then, the system administrator will check these files, he will move these files to another public download directory for other users to download, in this way, the remote host users are protected, to avoid someone uploading the problematic files, such as virus files. As an Internet user, you can copy files between any two Internet hosts via FTP. However, most people actually have only one Internet account, and FTP is used primarily to download public files, such as shareware, company technical support files, and so on. There are thousands of anonymous FTP hosts on the Internet that hold countless files for free copies. Virtually all types of information, all types of computer programs, can be found on the Internet. This is one of the important reasons why the Internet attracts us. Anonymous FTP anonymous FTP users have the opportunity to access the world's largest information base, the information base is cumulative, and is still growing, never shut down, involving almost all topics.   And, it's all for free. Anonymous FTP is a common method of publishing software on Internet. The internet continues today because people use programs that provide standard services through standard protocols.   Many of these programs, like this one, are published by anonymous FTP and can be accessed by anyone. With a huge number of anonymous FTP hosts and more files in the Internet, how exactly do you know which directory is on the anonymous FTP host for a particular file? This is exactly what the Archie server is doing. Archie will automatically search the FTP host, construct a database containing all the file directory information, so that you can directly find the location information of the required files. FTP user classification and permissions attribution to the real account such users refer to having an account on the FTP service. When such a user logs on to an FTP server, its default home directory is the directory named by its account. However, it can alsoChange to a different directory. such as the system's home directory and so on. Guest users in an FTP server, we often set up an account for different departments or for a specific user. However, this account has the feature that it can only access its own home directory. This way the server protects the security of other files on the FTP service. This type of account, in VSFTPD software, is called the Guest user. An account with such a user can access only the directory under its home directory and not the files outside the home directory. Anonymous (anonymous) User This is also what we usually call anonymous access.   This type of user means that no account is specified on the FTP server, but it can still access some publicly available resources anonymously. When we build the FTP server, we need to classify the user according to the type of the user. By default, the VSFTPD server will attribute all established accounts to real users. However, this often does not meet the needs of enterprise security. Because this type of user can not only access their own home directory, but also access to other users ' directories. This will give other users the space to bring a certain security risks. Therefore, the enterprise should according to the actual situation, modify the user's category. [1] FTP client FTP client. Volume can be said to be the smallest, only 330K, free Chinese version does not need to Chinese and cracked the sake of it. Features are also very powerful, everything.   can support multi-threaded upload, but also support the direct upload of compressed packets in the space directly after decompression. The 8uftp is a very incisive FTP client.   Currently the smallest FTP client tool.   Free Chinese version of life, non-Chinese version, non-cracked version.   Covers other FTP tools feature exclusive support multi-threaded upload, make upload faster and more stable. At the same time support directly upload compressed package, can be directly extracted in space.   You can also download the compressed package directly after the space is compressed. 8uftp2.6Upgrade Features1.increase the replication URL feature of the Remote FTP directory2.tools to increase the remote FTP directory and the local directory compare the general steps of transferring files via FTP command Prompt the computer that requires remote file transfer must be installed and running the FTP client. During the installation of the Windows operating system, TCP is typically installed/IP protocol software, which contains the FTP client program.   But the program is a character interface rather than a graphical interface, which must be done at the command prompt, which is inconvenient. Another way to start the FTP client work is to use IE browser, users only need to enter the URL address in the IE address bar in the following format: ftp://[Username: password @]ftp server domain name [: port number](in the cmd command line can also be connected with the above method, through the put command and get command to upload and download for the purpose of the LS command to list the directory, in addition to the above method can also be in the CMD input FTP enter, and then enter the open IP to establish a connection, This method is also applicable to the connection of FTP server under Linux, the method of starting FTP via IE browser, although it can be used, but it is slow, it will also expose the password to Internet Explorer instead of security.   Therefore, it is common to install and run dedicated FTP client programs. 1. Log on to the Internet on your local computer.   2. Search has a file sharing host or personal computer (usually has a dedicated FTP server website published on the above has access to the host or personal computer name, password and path).   3. When connected to the remote host or the other person's personal computer, log in to the host or the other person's personal computer using the user name and password provided by the other party.   4. After the remote host or the other person's personal computer login is successful, you can upload something you want to share with others or download something that someone else authorized to share (here is something that can be put on the computer and can be seen on the screen). 5. After completing the work, close the FTP download software and disconnect the connection.in order to implement file transfer, users also have to run special file transfer programs, such as the Internet Express has this aspect of the function, there are many other special FTP transmission software, FLASHFXP for the outstanding software. Interested users can try other software, such as Leapftp always have their own characteristics.FTP protocol TCP/in the IP protocol, the FTP standard command TCP port number is 21,port mode with a data port of 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 joined, or even whether the same operating system is used. If two computers are talking through the FTP protocol and have access to the Internet, you can use FTP commands to transfer files.   There are some minor differences in the use of each operating system, but the basic command structure for each protocol is the same.   There are two ways to transfer ftp: ASCII transfer mode and binary data transfer mode. 1.   ASCII transmission: Assuming that the user is copying a file containing simple ASCII code text, if the remote machine is not running UNIX, when the file transfer FTP will usually automatically adjust the contents of the file in order to interpret the file as another computer to store the text file format. However, it is often the case that users are transmitting files that contain not text files, which may be programs, databases, word processing files, or compressed files (although the word processing file contains mostly text, which also contains non-printable characters that indicate page size, font, and so on).   Before copying any non-text files, use binary command to tell FTP verbatim copy, do not handle these files, this is also the following binary transmission. 2. Binary transfer mode: In binary transmission, save the file's bit order so that the original and copy are bit-wise. Even files that contain bit sequences on the destination machine are meaningless.   For example, the Macintosh transmits the executable file to the Windows system in binary mode, and the file cannot be executed on the other system. If you transfer binary files in ASCII mode, they will be translated even if they are not required. This causes the transmission to be slightly slower, and it can corrupt the data, making the file useless. (on most computers, the ASCII approach generally assumes that the first significant bit of each character is meaningless, because the ASCII character combination does not use it.) If you transfer binary files, all the bits are important.   If you know that the two machines are the same, the binary method is valid for both the text file and the data file. 5. FTP works by FTP support two modes, one is called standard (that is, port mode, active mode), one is Passive (that is, PASV, passive mode). The standard mode FTP client sends the PORT command to the FTP server.   The passive mode FTP client sends the PASV command to the FTP Server. Here's how one of these two approaches works: the Port-mode FTP client first establishes a connection to the FTP server's TCP 21 port and sends a command through this channel, which sends the port command on this channel when the client needs to receive the data. The port command contains what ports the client uses to receive data. When transmitting data, the server connects to the client's specified port via its TCP 20 port to send the data.   The FTP server must establish a new connection with the client to transfer the data. The passive mode is similar to standard mode when establishing a control channel, but it is not the port command that is sent after the connection is established, but the PASV command. After the FTP server receives the PASV command, randomly opens a temporary port (also known as a free port, with a port number greater than 1023 less than 65535) and notifies the client of the request to transmit data on this port, the client connects to this port on the FTP server, and then the FTP server transmits the data through this port.   At this time, the FTP server no longer needs to establish a new and client connection. Many firewalls are not allowed to accept externally initiated connections when they are set up, so many FTP servers behind firewalls or intranet do not support PASV mode because clients cannot open the high-end port of the FTP server through the firewall, and many intranet clients cannot log on to the FTP server using port mode.   Because TCP 20 from the server cannot establish a new connection to the internal network client, it does not work. FTP software can better help you to manage the FTP directory to provide more systematic tools FTP tool recommended using CUTEFTP active and Passive mode FTP has two modes of use: active and passive. Active mode requires the client and server to open and listen to a port at the same time to establish a connection. In this case, the client has some problems because the firewall is installed. Therefore, the passive mode was created.   Passive mode only requires the server side to generate a process to listen to the appropriate port, so that you can bypass the client installed a firewall problem. An active mode FTP connection is established to follow these steps: The client opens a random port (the port number is greater than 1024, where we call it X), and an FTP process connects to the server's 21st command port. At this point, the source port is randomPort x, on the client, the remote port is 21, on the server. The client starts listening on the port (x+1), while sending a port command to the server (via the server's 21st command port), this command tells the server that the client is listening on the port number and is ready to receive data from this port.   This port is the data port we know of. The server opens the source port 20th and establishes a connection to the client data port. At this point, the source port is 20 and the remote Data port is (x+1). The client establishes a connection to the server port 20th through the local data port, and then sends an answer to the server telling the server that it has established a connection. Thank you, Mr. von Neumann .He was the first computer in the world, which made us descendants Niaoqianghuanpao, "Academic bandits" by "scissors plus paste" to "Academic pirates" of "Mouse plus clipboard".thanks to the teacher in charge of the replyIn the case that I don't understand what is being written, they only ask me two questions--do they know what they're writing? Do you know the references? And then I passed the plea. They are such amiable teachers, they are so considerate teachers, they are so approachable and great teachers.

FTP protocol detailed (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.