File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one host to another host over a TCP-based network, such as the Internet. FTP is built on a client-server architecture and uses separate control and data connections between the client and the server.FTP users may authenticate themselves using a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that hides (encrypts) the username and password, and encrypts the content, FTP is often secured with SSL/TLS (“FTPS”). SSH File Transfer Protocol (“SFTP”) is sometimes also used instead, but is technologically different. The first FTP client applications were command-line applications developed before operating systems had graphical user interfaces, and are still shipped with most Windows, Unix, and Linux operating systems.
Dozens of FTP clients and automation utilities have since been developed for desktops, servers, mobile devices, and hardware, and FTP has been incorporated into hundreds of productivity applications, such as Web page editors. While transferring data over the network, four data representations can be used: •ASCII mode: used for text. Data is converted, if needed, from the sending host’s character representation to “8-bit ASCII” before transmission, and (again, if necessary) to the receiving host’s character representation. As a consequence, this mode is inappropriate for files that contain data other than plain text.
•Image mode (commonly called Binary mode): the sending machine sends each file byte for byte, and the recipient stores the bytestream as it receives it. (Image mode support has been recommended for all implementations of FTP). •EBCDIC mode: use for plain text between hosts using the EBCDIC character set. This mode is otherwise like ASCII mode. •Local mode: Allows two computers with identical setups to send data in a proprietary format without the need to convert it to ASCII Data transfer can be done in any of three modes
•Stream mode: Data is sent as a continuous stream, relieving FTP from doing any processing. Rather, all processing is left up to TCP. No End-of-file indicator is needed, unless the data is divided into records. •Block mode: FTP breaks the data into several blocks (block header, byte count, and data
field) and then passes it on to TCP. •Compressed mode: Data is compressed using a single algorithm (usually run-length encoding).
FTP login utilizes a normal username and password scheme for granting access. The username is sent to the server using the USER command, and the password is sent using the PASS command. If the information provided by the client is accepted by the server, the server will send a greeting to the client and the session will commence. If the server supports it, users may log in without providing login credentials, but the same server may authorize only limited access for such sessions.
A host that provides an FTP service may provide anonymous FTP access. Users typically log into the service with an ‘anonymous’ (lower-case and case-sensitive in some FTP servers) account when prompted for user name. Although users are commonly asked to send their email address instead of a password, no verification is actually performed on the supplied data. Many FTP hosts whose purpose is to provide software updates will allow anonymous logins.
An FTP Command List
The following is a summary of the commonly used FTP Commands. CommandDescription
! Preceding a command with the exclamation point will cause the command to execute on the local system instead of the remote system. ? Request assistance or information about the FTP commands. This command does not require a connection to a remote system. ascii Set the file transfer mode to ASCII (Note: this is the default mode for most FTP programs). bell Turns bell mode on / off. This command does not require a connection to a remote system. binary Set the file transfer mode to binary (Note: the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files). bye Exit the FTP environment (same as quit). This command does not require a connection to a remote system. cd Change directory on the remote system. close Terminate a session with another system.
debug Sets debugging on/off. This command does not require a connection to a remote system. delete Delete (remove) a file in the current remote directory (same as rm in UNIX). dir Lists the contents of the remote directory.The asterisk (*) and the question mark (?) may be used as wild cards. For example: get WIP
help Request a list of all available FTP commands. This command does not require a connection to a remote system. lcd Change directory on your local system (same as CD in UNIX). ls List the names of the files in the current remote directory. mget WIP
mkdir Make a new directory within the current remote directory. mput Copy multiple files from the local system to the remote system. (Note: You will be prompted for a “y/n” response before copying each file). open Open a connection with another system.
put Copy a file from the local system to the remote system. pwd Find out the pathname of the current directory on the remote system. quit Exit the FTP environment (same as “bye”). This command does not require a connection to a remote system. rmdir Remove (delete) a directory in the current remote directory. trace Toggles packet tracing. This command does not require a connection to a remote system.
FTP was not designed to be a secure protocol—especially by today’s standards—and has many security weaknesses.In May 1999, the authors of RFC 2577 listed a vulnerability to the following problems. •Brute force attacks
•Packet capture (sniffing)
FTP is not able to encrypt its traffic; all transmissions are in clear text, and usernames, 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 of the Internet Protocol specifications (such as SMTP, Telnet, POP and IMAP) that were designed prior to the creation of encryption mechanisms such as TLS or SSL. A common solution to this problem is to use the “secure”, TLS-protected versions of the insecure protocols (e.g. FTPS for FTP, TelnetS for Telnet, etc.) or 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. Secure FTP
There are several methods of securely transferring files that have been called “Secure FTP” at one point or another. Syntax
FTP URL syntax is described in RFC173,taking the form: ftp://[[:]@][:]/ (The bracketed parts are optional.) For example: ftp://public.ftp-servers.example.com/mydirectory/myfile.txt
ftp://user001:[email protected]/mydirectory/myfile.txt More details on specifying a username 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.