<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> <title>Introduction to the FTP Protocol - Apache HTTP Server</title> <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /> <link href="../images/favicon.ico" rel="shortcut icon" /></head> <body id="manual-page"><div id="page-header"> <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p> <p class="apache">Apache HTTP Server Version 2.2</p> <img alt="" src="../images/feather.gif" /></div> <div class="up"><a href="../"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> <div id="path"> <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a></div><div id="page-content"><div id="preamble"><h1>Introduction to the FTP Protocol</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/ftp/ftp_intro.html" title="English"> en </a></p> </div> <p>The <strong>File Transfer Protocol (FTP)</strong> is a classic standard for transfer of files and records over a TCP/IP network. It was defined by Jon Postel and Joyce Reynolds in <a href="http://www.rfc-archive.org/getrfc.php?rfc=959">RFC 959</a>, which was released in 1985. This means that FTP precedes the HTTP protocol that is usually associated with the Apache server by more than half a decade. The <code>mod_ftp</code> module brings support for FTP to the Apache server and includes several updates to the original protocol. Most notably, <code>mod_ftp</code> implements FTP over Transport Layer Security (TLS) as described in <a href="http://www.rfc-archive.org/getrfc.php?rfc=4217">RFC 4217</a>.</p> <p>On this manual page, a brief technical overview of the FTP protocol is provided, followed by a discussion of the FTP implementation by <code>mod_ftp</code>. </p> </div> <div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="http://www.rfc-archive.org/getrfc.php?rfc=959">RFC 959 — FILE TRANSFER PROTOCOL (FTP)</a></li><li><a href="http://www.rfc-archive.org/getrfc.php?rfc=1579">RFC 1579 — Firewall-Friendly FTP</a></li><li><a href="http://www.rfc-archive.org/getrfc.php?rfc=4217">RFC 4217 — Securing FTP with TLS</a></li><li><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></li><li><a href="../howto/auth.html">Authentication, Authorization and Access Control</a></li></ul></div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="protocol_overview" id="protocol_overview">Overview of the FTP Protocol</a></h2> <p>The File Transfer Protocol (FTP) is designed to facilitate bi-directional transfer of files and records between hosts on a TCP/IP network. Unlike HTTP, the FTP protocol is stateful: the client establishes a <em>Control Connection</em> for the duration of an FTP session that typically spans multiple data transfers.</p> <p>FTP uses a separate TCP connection for data transfer. Commands are issued and acknowledged over the <em>Control Connection</em>, a TCP connection to well-known port 21. If the user issues a command that requires a response more elaborate than a one-line response code, a <em>Data Connection</em> is established between the client and the server. The response data—the contents of a file or a directory listing—is sent over that data connection.</p> <p>Historically, the data connection was established from the server back to the client. The client would bind to an arbitrary port, and then transmit its IP address and the port number to the server using the <em>PORT</em> command. The server then set up a data connection to that port on the client host, whereupon the client issues the data transfer command. This approach is referred to as <em>Active</em> FTP (since the server acts to set up the data connection). Unfortunately, active FTP does not work well with firewalls and Network Address Translation (NAT) because incoming connections are often blocked. In the case of NAT, the client only instructs the server to connect to its internal, non-routable IP address. Some firewalls and NAT routers support the FTP protocol, but this support is not universal. In cases where FTP is supported, these devices can rewrite the PORT command and establish ad-hoc access rules for FTP data connections.</p> <p>Because of these limitations, an alternative approach was developed in which the direction of the data connection is reversed. This is known as <em>Passive</em> FTP. Before starting a data transfer, the client issues a <em>PASV</em> command. The server binds to an arbitrary port number and transmits its IP address and that port number back to the client. The client then sets up a data connection to this address and port on the server, and issues the data transfer command. Passive FTP is more firewall-friendly than Active FTP, because client-side firewalls are typically more lenient on outgoing connections than inbound ones.</p> <p>While it is possible for FTP to support unauthenticated sessions, in practice all sessions are authenticated. Typically, FTP servers authenticate against the user database of the server on which they run. To facilitate downloads by the general public, FTP servers generally support a special username (by convention <em>"anonymous"</em> or <em>"ftp"</em>) to provide read-only access. Users are asked (but often not required) to provide their e-mail address as response to the <code>Password</code> prompt. </p> <p>For more information on the basic functionality of the FTP protocol please refer to <a href="http://www.rfc-archive.org/getrfc.php?rfc=959">RFC 959</a> or <a href="http://en.wikipedia.org/wiki/FTP">Wikipedia</a>.</p> </div></div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/ftp/ftp_intro.html" title="English"> en </a></p> </div><div id="footer"> <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div> </body></html>