FTP Protocol Basics

Source: Internet
Author: User

File Sharing Service

FTP: Application layer, can cross-platform, but the data editing is difficult to achieve;

NFS (Sun): Kernel, cross-platform difficulty;

Samba: cross-platform, Linux or UNIX implementation of the CIFS (SMB) protocol-that is, the UNIX common File system protocol;

The existing three types of storage models

DNS: Direct attached storage, such as a hard disk in the chassis;

NAS: Network attached storage, providing file-level shared storage through a network file server, working in application space, NFS and Samba CIFS is the implementation of NAS;

SAN: Network attached storage, through the network file server to provide block-level shared storage, working in the kernel space;

Ftp:flie Transfer Protocol , File Transfer Protocol

Basic points of knowledge

Application Layer Protocol

There are multiple connections, the default is just enabled when listening to 21/tcp, based on the socket complete cross-host communication

C/S Architecture

Server:

WU-FTPD (Washington University Research and Development), PROFTPD,PUREFTP,VSFTP,SERVU

Client:

Ftp,lftp,lftpget,wget,curl,filezilla (Windows, Linux), Gftp (Linux GUI), FLASHFXP (Windows), CuteFTP (Windows)

Response code

1XX: Prompt Information

2XX: Success Class status Code

3XX: The user is prompted to provide additional information about the status code

4XX: Client Error

5XX: Service-side error

See the example diagram below

User authentication

Virtual user : Used only to access resources in a particular service

Nsswitch

network server switch, net name translation, is a name resolution framework

Configuration file:/etc/nsswitch.conf

Module:/lib64/libnss*,/usr/lib64/libnss*

Pam

Pluggable authentication module, plug-in authentication module, is a user authentication framework

Configuration file:/etc/pam.conf,/etc/pam.d/*

Module:/lib64/security/

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/79/wKiom1VJ3XCCZcANAAFzdSshkiQ529.jpg "title=" 1.png " alt= "Wkiom1vj3xcczcanaafzdsshkiq529.jpg"/>

System users

Anonymous user

FTP two kinds of data connection modes for the server

Command connection

Transfer the File Management Class command, complete the entire data Transmission control; Persistent connection until the user terminates the removal;

Data connection

Transfer data requested by the user; non-persistent connection, established before each transfer of data, automatic removal after transmission is complete

Example Description : Users want to go to FTP The server downloads a file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/75/wKioL1VJ3wXDXXApAAEgA54zrvM730.jpg "title=" 2.png " alt= "Wkiol1vj3wxdxxapaaega54zrvm730.jpg"/>

Data transfer format

Supports text transfer and binary transfer, typically selecting a transmission format based on the data native encoding format

Data transfer Mode

Active : The connection is created by the server

Command connection:

client:50000-->server:21

Data connection:

Server:20/tcp-->client:50000+1

The client uses a random port (such as 50000 ) to the server 21/tcp the port initiates a command connection, and after the connection succeeds, the server uses ( 21- 1 ) /tcp Port to the client's random port ( 50000-1 , if it is occupied 50000-2 ) Proactively initiate a data connection, which is the active mode

Because the client is mostly equipped with firewalls, the server actively establishes the data connection will be blocked by the firewall, thereby creating a passive connection.

Passive : The connection is created by the client

Command connection:

client:50000-->server:21

121,23:121x256+23

Data connection:

Client:50000+1--> Server: Immediately port

When a server receives a command connection to a client, it starts a child process, listens to a random port, and the server notifies the client of the child process and its listening port number (such as 121,23) through a command connection, so that the client can initiate an active data connection to the port, as shown in the following example diagram.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/75/wKioL1VJ3yCAhavDAAFG0GzL-TI024.jpg "title=" 3.png " alt= "Wkiol1vj3ycahavdaafg0gzl-ti024.jpg"/>

The server firewall has a connection tracing (Connectiontrack) feature that identifies the data connection associated with the client-initiated command connection, opening the appropriate port to it

Example diagram

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/79/wKiom1VJ3ciwkLyWAAEjmMpdky8795.jpg "title=" 4.png " alt= "Wkiom1vj3ciwklywaaejmmpdky8795.jpg"/>

FTP and the lftp Command

When using the LFTP command to connect to an FTP server, anonymous users will log in directly

To log in with a specific user, you need to use the following command:

lftp-u username[,PASSWORD] Ftpip

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/75/wKioL1VJ30iiEUz4AAD1wjFjkvM574.jpg "title=" 5.png " alt= "Wkiol1vj30iieuz4aad1wjfjkvm574.jpg"/>

LFTP support for breakpoint continuation and multi-threaded download, dependent on the Axel tool, need to compile the installation

1. Download the source package

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/79/wKiom1VJ3fGx1kZxAARMtHovKMk803.jpg "title=" 6.png " alt= "Wkiom1vj3fgx1kzxaarmthovkmk803.jpg"/>

2, compile and install, generate Axel Tools

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/75/wKioL1VJ33XRq5I4AARiDzRJFIw495.jpg "title=" 7.png " alt= "Wkiol1vj33xrq5i4aaridzrjfiw495.jpg"/>

3, copy to the/bin directory can be used

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/79/wKiom1VJ3hSR0H5GAAGTZyjAHXE272.jpg "title=" 8.png " alt= "Wkiom1vj3hsr0h5gaagtzyjahxe272.jpg"/>

4. Axel Syntax format

Axel-n 3-o/root Ftp://172.16.0.1/pub/somefile

-N: Indicates the number of download threads enabled

-O: Indicates where to save the downloaded file

Finally indicate the path of the download resource

Add

The FTP protocol is clear, and for security reasons, you can use the following protocol instead

FTPS: SSL-based

SFTP: SSH-based


FTP Protocol Basics

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.