5.1 FTP and VSFTP

Source: Internet
Author: User
Tags ftp client

File Transfer Protocol, FTP), as the name suggests, is the communication Protocol used during File transmission, it appears on the TCP/IP network and the Internet for a long time, FTP is an indispensable tool for network transmission before HTTP is widely used.
FTP features
Although WWW has replaced some FTP functions, it still has unique features.
◆ Interactive access
FTP allows users and servers to access server resources through interaction. For example, you can require the FTP server to list files in a directory or transmit files in binary mode.
◆ Specify the downloaded file format
FTP allows the client to specify the file storage format. For example, when you access data on the FTP server, you can specify text files or binary files. You can also specify text files in ASCII or EBCDIC format.

Ftp> binary
# Binary transmission
200 Switching to Binary mode.
◆ Stable transmission mechanism
The biggest difference between FTP and other communication protocols is that it uses two connection ports to connect to the client: TCP 20 and TCP-1. Among them, the connection port TCP 20 is used to transmit data, while TCP 21 is responsible for controlling the transmission process. This design can support multiple clients to connect to the FTP server at the same time, and has stable advantages.
Figure 5-1 use two connection ports to communicate with the client

◆ Authentication control
Before a user accesses server resources, the FTP server requires the user to enter the account name and password to verify the identity. If anonymous access is allowed, the user simply enters "anonymous" as the account name, And the password will not be verified.
Name (ftp.fc5linux.com: jack): jack
# Enter the user account name
331 Please specify the password.
Password:
# Enter the user account password
30 Login successful.
◆ Cross-platform data exchange
FTP allows file transfer between different network architectures or operating systems, such as between Linux and Windows, so it is an excellent cross-platform solution.
Data exchange between servers and clients
FTP uses TCP as the communication protocol during transmission, so it can provide connection-oriented transmission with high reliability. The data exchange process between the FTP server and the client computer is as follows, figure 5-2 shows the data exchange process between the server and the client.
1) the FTP client uses the "three-way handshake" method to establish a TCP session with the FTP server.
2) the FTP server uses the TCP 21 port to send and receive FTP control information. It is mainly used to listen to client connection requests. After establishing a connection, the connection port will be opened throughout the session.
3) the FTP server uses the TCP 20 port to transmit and receive files, which may be ASCII or binary files), but it will immediately disable the file after the file is transmitted.
4) When an FTP client initiates a connection request to the FTP server, it dynamically specifies a connection port number. Generally, the connection ports specified by these clients are from 1024 to 65535, because 0 to 1023 has been pre-specified for communication protocols or other services by IANAInternet Assigned Numbers Authority.
5) After an FTP session is established, the client opens a connection port to connect to the TCP 21 connection port on the server.
6) When file transmission starts, the client opens another connection port to connect to the TCP 20 connection port on the server, the client opens another connection port to transfer files.
Figure 5-2 data exchange between servers and clients
FTP Architecture
FTP is a communication protocol in the client/server architecture. Therefore, when transferring files between two hosts, one of them must execute FTP server software, such as VSFTP, the other one needs to execute the FTP client program, such as IE 6.0 or ftp command. Generally, a file is transmitted in two forms:
◆ Download: the file is transmitted to the client by the FTP server.
◆ Upload: files are transmitted from the client to the FTP server.
VSFTP Server Installation
In Fedora Core 5, the built-in FTP server software is VSFTP, which is short for Very Secure FTP which is Very Secure), indicating that it emphasizes its security control, you can choose to install VSFTP during operating system installation.
By default, Fedora Core 5 does not install VSFTP server software package vsftpd. Therefore, you must use the "Software Package Manager" to find the server software package named "vsftpd", as shown in Figure 5-3.
Figure 5-3 install the VSFTP server package
After installing the VSFTP server, the simplest startup method is as follows:
[Root @ ns1 ~] #/Etc/rc. d/init. d/vsftpd start
Starting vsftpd in vsftpd: OK]
To stop a VSFTP server, run the following command:
[Root @ ns1 ~] #/Etc/rc. d/init. d/vsftpd stop
Disabling vsftpd: OK]
You can restart the VSFTP server by using the following methods:
[Root @ ns1 ~] #/Etc/rc. d/init. d/vsftpd restart
Disabling vsftpd: OK]
Starting vsftpd in vsftpd: OK]
Because the FTP service is a very important task for servers, it should be automatically started during boot to save time for manual start and prevent servers from stopping services due to forgetting to start them.
To automatically start the VSFTP server during boot, run the following chkconfig command:
[Root @ ns1 ~] # Chkconfig -- level 5 vsftpd on
[Root @ ns1 ~] # Chkconfig -- list | grep vsftpd
Vsftpd 0: Close 1: Close 2: Close 3: Close 4: Close 5: Open 6: Close
The preceding command indicates that if the system runs Run Level 5, the VSFTP server vsftpd is automatically started. You can also use the -- list parameter to check whether the VSFTP server is automatically executed at each running Level.
Note:For more information about how to automatically start VSFTP during boot, see the previous section.
Test the VSFTP Server
After completing the preceding installation, startup, and setup steps, you can use the telnet command to log on to port 21 on the VSFTP server to test whether the VSFTP server is correctly started. The following is a simple example:
[root@ns1 root]# telnet ftp.fc5linux.com 21
Trying 192.168.0.1...
Connected to ns1.fc5linux.com (192.168.0.1).
Escape character is '^]'.
220 (vsFTPd 1.2.1)

^]
telnet> q

BibliographyPrevious sectionNext section

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.