- Order:
- Duration: 3:39
- Published: 2009-01-07
- Uploaded: 2011-01-08
- Author: gtmaster07
these configurations will be saved for each time you visit this page using this browser
File Transfer Protocol (FTP) is a standard network protocol used to copy a file from one host to another over a TCP/IP-based network, such as the Internet. FTP is built on a client-server architecture and utilizes separate control and data connections between the client and server. FTP users may authenticate themselves using a clear-text sign-in protocol but can connect anonymously if the server is configured to allow it.
The first FTP client applications were interactive command-line tools, implementing standard commands and syntax. Graphical user interface clients have since been developed for many of the popular desktop operating systems in use today.
A client makes a TCP connection to the server's port 21. This connection, called the control connection, remains open for the duration of the session, with a second connection, called the data connection, opened by the server from its port 20 to a client port (specified in the negotiation dialog) as required to transfer file data. The control connection is used for session administration (i.e., commands, identification, passwords) exchanged between the client and server using a telnet-like protocol. For example "RETR filename" would transfer the specified file from the server to the client. Due to this two-port structure, FTP is considered an out-of-band, as opposed to an in-band protocol such as HTTP.
While transferring data over the network, four data representations can be used:
FTP was not designed to encrypt its traffic; all transmissions are in clear text, and user names, passwords, commands and data can be easily read by anyone able to perform packet capture (sniffing) on the network. This problem is common to many Internet Protocol specifications (such as SMTP, Telnet, POP and IMAP) designed prior to the creation of encryption mechanisms such as TLS or SSL. A common solution to this problem is use of the "secure", TLS-protected versions of the insecure protocols (e.g. FTPS for FTP, TelnetS for Telnet, etc.) or selection of a different, more secure protocol that can handle the job, such as the SFTP/SCP tools included with most implementations of the Secure Shell protocol.
FTP URL syntax is described in RFC1738, taking the form:
(The bracketed parts are optional.) For example:
ftp://public.ftp-servers.example.com/mydirectory/myfile.txt
or:
ftp://user001:secretpassword@private.ftp-servers.example.com/mydirectory/myfile.txt
More details on specifying a user name and password may be found in the browsers' documentation, such as, for example, Firefox and Internet Explorer.
By default, most web browsers use passive (PASV) mode, which more easily traverses end-user firewalls.
There are two approaches to this problem. One is that the FTP client and FTP server use the PASV command, which causes the data connection to be established from the FTP client to the server. This is widely used by modern FTP clients. Another approach is for the NAT to alter the values of the PORT command, using an application layer gateways for this purpose.
==FTP over SSH (not SFTP)== FTP over SSH (not SFTP) refers to the practice of tunneling a normal FTP session over an SSH connection.
Because FTP uses multiple TCP connections (unusual for a TCP/IP protocol that is still in use), it is particularly difficult to tunnel over SSH. With many SSH clients, attempting to set up a tunnel for the control channel (the initial client-to-server connection on port 21) will protect only that channel; when data is transferred, the FTP software at either end will set up new TCP connections (data channels), which bypass the SSH connection, and thus have no confidentiality, integrity protection, etc.
Otherwise, it is necessary for the SSH client software to have specific knowledge of the FTP protocol, and monitor and rewrite FTP control channel messages and autonomously open new forwardings for FTP data channels. Version 3 of SSH Communications Security's software suite, the GPL licensed FONC, and Co:Z FTPSSH Proxy are three software packages that support this mode.
FTP over SSH is sometimes referred to as secure FTP; this should not be confused with other methods of securing FTP, such as with SSL/TLS (FTPS). Other methods of transferring files using SSH that are not related to FTP include SFTP and SCP; in each of these, the entire conversation (credentials and data) is always protected by the SSH protocol.
{|class="wikitable sortable" style="width: 100%" |- ! Command ! RFC !class="unsortable"|Description |- | ABOR | | Abort an active file transfer. |- | ACCT | | Account information. |- | ADAT | RFC 2228 | Authentication/Security Data |- | ALLO | | Allocate sufficient disk space to receive a file. |- | APPE | | Append. |- | AUTH | RFC 2228 | Authentication/Security Mechanism |- | CCC | RFC 2228 | Clear Command Channel |- | CDUP | | Change to Parent Directory. |- | CONF | RFC 2228 | Confidentiality Protection Command |- | CWD | | Change working directory. |- | DELE | | Delete file. |- | ENC | RFC 2228 | Privacy Protected Channel |- | EPRT | RFC 2428 | Specifies an extended address and port to which the server should connect. |- | EPSV | RFC 2428 | Enter extended passive mode. |- | FEAT | RFC 2389 | Get the feature list implemented by the server. |- | HELP | | Returns usage documentation on a command if specified, else a general help document is returned. |- | LANG | RFC 2640 | Language Negotiation |- | LIST | | Returns information of a file or directory if specified, else information of the current working directory is returned. |- | LPRT | RFC 1639 | Specifies a long address and port to which the server should connect. |- | LPSV | RFC 1639 | Enter long passive mode. |- | MDTM | RFC 3659 | Return the last-modified time of a specified file. |- | MIC | RFC 2228 | Integrity Protected Command |- | MKD | | Make directory. |- | MLSD | RFC 3659 | Lists the contents of a directory if a directory is named. |- | MLST | RFC 3659 | Provides data about exactly the object named on its command line, and no others. |- | MODE | | Sets the transfer mode (Stream, Block, or Compressed). |- | NLST | | Returns a list of file names in a specified directory. |- | NOOP | | No operation (dummy packet; used mostly on keepalives). |- | OPTS | RFC 2389 | Select options for a feature. |- | PASS | | Authentication password. |- | PASV | | Enter passive mode. |- | PBSZ | RFC 2228 | Protection Buffer Size |- | PORT | | Specifies an address and port to which the server should connect. |- | PROT | RFC 2228 | Data Channel Protection Level. |- | PWD | | Print working directory. Returns the current directory of the host. |- | QUIT | | Disconnect. |- | REIN | | Re initializes the connection. |- | REST | | Restart transfer from the specified point. |- | RETR | | Transfer a copy of the file |- | RMD | | Remove a directory. |- | RNFR | | Rename from. |- | RNTO | | Rename to. |- | SITE | | Sends site specific commands to remote server. |- | SIZE | RFC 3659 | Return the size of a file. |- | SMNT | | Mount file structure. |- | STAT | | Returns the current status. |- | STOR | | Accept the data and to store the data as a file at the server site |- | STOU | | Store file uniquely. |- | STRU | | Set file transfer structure. |- | SYST | | Return system type. |- | TYPE | | Sets the transfer mode (ASCII/Binary). |- | USER | | Authentication username. |}
* List of FTP server return codes - in response to commands from a client, the FTP server returns reply codes
Category:Clear text protocols Category:Network file transfer protocols Category:History of the Internet Category:Application layer protocols Category:Internet protocols Category:Internet standards Category:Unix network-related software
This text is licensed under the Creative Commons CC-BY-SA License. This text was originally published on Wikipedia and was developed by the Wikipedia community.