File transfer protocol
Internet protocol suite
||HTTP, SMTP, FTP, SSH, IRC, SNMP ...
||TCP, UDP, SCTP, RTP, DCCP ...
||IPv4, IPv6, ARP, IPX ...
|Data link layer
||Ethernet, 802.11 WiFi, Token ring, FDDI, ...
The File Transfer Protocol (FTP) is a software standard for transferring computer files between machines with widely different operating systems. It belongs to the application layer of the Internet protocol suite.
FTP is an 8-bit client-server protocol, capable of handling any type of file without further processing, such as MIME or Uuencode. However, FTP has extremely high latency; that is, the time between beginning the request and starting to receive the required data can be quite long, and a sometimes-lengthy login procedure is required.
FTP is commonly run on two ports, 20 and 21. Port 20 is a data stream which transfers the data between the client and the server. Port 21 is the control stream and is the port where commands are passed to the ftp server. While data is being transferred via the data stream, the control stream sits idle. This can cause problems with large data transfers through firewalls which time out sessions after lengthy periods of idleness. While the file may well be successfully transferred, the control session can be disconnected by the firewall, causing an error to be generated.
The objectives of FTP are:
- To promote sharing of files (computer programs and/or data).
- To encourage indirect or implicit use of remote computers.
- To shield a user from variations in file storage systems among different hosts.
- To transfer data reliably and efficiently.
- Passwords and file contents are sent in clear text, allowing eavesdropping which may be unwanted.
- It is hard to filter active mode FTP traffic on the client side by using a firewall, since the client must open a random port in order to make the connection. This problem is largely resolved by using passive mode FTP.
- It is possible to tell a server to send to an arbitrary port of a third computer.
FTP, though usable directly by a user at a terminal, is designed mainly for use by FTP client programs.
Many sites that run FTP servers enable so-called "anonymous ftp". Under this arrangement, users do not need an account on the server. By default, the account name for the anonymous access is 'anonymous'. This account does not need a password. Although users are commonly asked to send their email addresses as their passwords for authentication, there is no verification.
Active and passive mode
There are two modes that can be used for FTP: active and passive. Active mode requires both the client and the server to open a port and listen on it in order to establish an FTP session. As this often causes problems with firewalls on the client computer, passive mode was created. Passive mode requires only the server to have a process listen on a port, and thus bypasses firewall issues on the client computer.
An active mode FTP connection is established in the following manner:
- A random unprivileged port (a port with a number above 1024, in this case we will call it x) is opened on the client and the FTP program connects to port 21, known as the command port, on the server. The source port is now the random port number x on the client and the destination port is port 21 on the server.
- The client starts listening to port (x+1) and sends a PORT command to the server (via the server's command port 21) that tells the server the port number it is listening to and that it is ready to receive data on this port. This port is known as the data port.
- The server opens source port 21 and connects to the client's data port. The source port is port 21, and the data port (x+1) is the destination port.
- The client opens a connection to port 21 on the server via the client's data port and then sends the server an acknowledgment that it has established the connection.
FTP and web browsers
Most recent web browsers and file managers can connect to FTP servers. This allows manipulation of remote files over FTP through an interface similar to that used for local files. This is done via an FTP URL, which takes the form ftp://<ftpserveraddress> (e.g., ftp://ftp.gimp.org/). A password can optionally be given in the URL, thusly:
ftp://<login>:<password>@<ftpserveraddress>. Most web-browsers require the use of passive mode FTP, which not all FTP servers are capable of handling.
The protocol is standardized in RFC 0959 by the IETF as:
- RFC 0959 File Transfer Protocol (FTP). J. Postel, J. Reynolds. Oct-1985. (Format: TXT, 147316 bytes at http://www.ietf.org/rfc/rfc959.txt) This obsoleted the preceding RFC 765 and earlier FTP RFCs back to the original RFC 114.
- NcFTP Client (http://www.ncftp.com/) a free FTP client program with a command-line interface that has been maintained since 1990.
FileZilla 2.2.1b FTP client on Windows 2000
- Filezilla (http://filezilla.sourceforge.net/) a freely distributable GPL licensed FTP client for Windows.
- Cyberduck (http://cyberduck.ch/) a freely distributable GPL licensed FTP/SFTP client for Mac OS X.
- FTP Tutorial (http://www.tombraider4u.com/ftptutorial.shtml) Basic commands
- 01FTP (http://01ftp.com/) a free web based FTP service.
- RFC 0959 File Transfer Protocol (FTP). J. Postel, J. Reynolds. Oct-1985. (http://www.ietf.org/rfc/rfc959.txt)
- An Overview of the File Transfer Protocol (http://www.ncftp.com/libncftp/doc/ftp_overview.html) explains how the FTP works at the protocol level.
- The FTP and Your Firewall (http://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html) details FTP's problems with firewalls and how to deal with them.
- Tutorials for Beginning Computer Users: Introduction to the File Transfer Protocol (FTP) (http://www.bleepingcomputer.com/forums/tutorial46.html)
- Active vs. Passive FTP explained and illustrated (http://slacksite.com/other/ftp.html)
bg:File Transfer Protocol
de:File Transfer Protocol
fr:File transfer protocol
nl:File Transfer Protocol
ja:File Transfer Protocol