Site icon Tutorial

FTP

File Transfer Protocol (FTP) is a network protocol to transfer files from one host or to another host over a TCP-based network, such as the Internet. It is a client-server architecture and using separate control and data connections between the client and the server. Authentication is in clear-text username and password, and if allowed on server, anonymous access can also be done. Secure transmission with traffic encryption uses SSL/TLS and called SSH FTP or SFTP.

FTP was specified in June 1980 and updated in RFC 959. FTP server responds over the control connection with three-digit status codes in ASCII with an optional text message like 200 or “200 OK” for successful last command. FTP process between Client “A” and server “S” is shown

Both the client and server have two processes allowing these two types of information to be managed

When an FTP client is connected to a FTP server, the USER-PI initiates the connection to the server according to the Telnet protocol. The client sends FTP commands to the server, the server interprets them, runs its DTP, then sends a standard response. Once the connection is established, the server-PI gives the port on which data will be sent to the Client DTP. The client DTP then listens on the specified port for data coming from the server.

FTP may be in active or passive mode. In active mode FTP the client connects from a random unprivileged port (N > 1023) to the FTP server’s command port, port 21. Then, the client starts listening to port N+1 and sends the FTP command PORT N+1 to the FTP server. The server will then connect back to the client’s specified data port from its local data port, which is port 20. In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server. When opening an FTP connection, the client opens two random unprivileged ports locally (N > 1023 and N+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command. The result of this is that the server then opens a random unprivileged port (P > 1023) and sends the PORT P command back to the client. The client then initiates the connection from port N+1 to port P on the server to transfer data. While transferring data over the network, four data representations can be used ASCII mode (for text in 8-bit ASCII), image or binary mode (sends data as bytestream), EBCDIC mode (for text using the EBCDIC character set) and local mode (end nodes send data in a proprietary format).

Data transfer is done in three modes of stream (data is sent as a continuous stream and no EOF needed) , block mode (data broken into blocks like block header, byte count and data field) and compressed mode ( data is compressed by run-length encoding).

Secure File Transfer Protocol (SFTP)

SFTP is a network protocol to provide FTP data transfer over reliable data connection. SFTP uses SSH to provide encrypted connection over the SSH port 22. SFTP connection encrypts commands and data channels to prevent password and sensitive information from being transmitted insecurely over the network. Except for the method of connecting, SFTP functioning is similar to FTP. An SFTP-enabled FTP client and server are needed for implementing SFTP.

FTP Modes

When an FTP client application initiates a connection to an FTP server, it opens port 21 on the server — known as the command port. This port is used to issue all commands to the server. Any data requested from the server is returned to the client via a data port. The port number for data connections, and the way in which data connections are initialized, vary depending upon whether the client requests the data in active or passive mode. The following defines these modes

vsftpd

The Very Secure FTP Daemon (vsftpd) is designed from the ground up to be fast, stable, and, most importantly, secure. vsftpd is the only stand-alone FTP server distributed with Fedora, due to its ability to handle large numbers of connections efficiently and securely.

The vsftpd RPM installs the daemon (/usr/sbin/vsftpd), its configuration and related files, as well as FTP directories onto the system. The following lists the files and directories related to vsftpd configuration

Although vsftpd may not offer the level of customization other widely available FTP servers have, it offers enough options to fill most administrator’s needs. The fact that it is not overly feature-laden limits configuration and programmatic errors.

All configuration of vsftpd is handled by its configuration file, /etc/vsftpd/vsftpd.conf. Each directive is on its own line within the file and follows the following format

directive=value

For each directive, replace directive with a valid directive and value with a valid value. The following is a list of directives which control the overall behavior of the vsftpd daemon.

The following is a list of directives which control the login behavior and access control mechanisms.

The following lists directives which control anonymous user access to the server. To use these options, the anonymous_enable directive must be set to YES.

Back to Tutorial

Apply for Linux Administration Certification Now!!

http://www.vskills.in/certification/Certified-Linux-Administrator

Exit mobile version