Email This Page

FTP: File Transfer Protocol

File Transfer Protocol (FTP) enables file sharing between hosts. FTP uses TCP to create a virtual connection for control information and then creates a separate TCP connection for data transfers. The control connection uses an image of the TELNET protocol to exchange commands and messages between hosts.

The key functions of FTP are:

1)to promote sharing of files (computer programs and/or data),

2)to encourage indirect or implicit (via programs) use of remote computers,

3)to shield a user from variations in file storage systems among hosts, and

4)to transfer data reliably and efficiently. FTP, though usable directly by a user at a terminal, is designed mainly for use by programs.

FTP control frames are TELNET exchanges and can contain TELNET commands and option negotiation. However, most FTP control frames are simple ASCII text and can be classified as FTP commands or FTP messages. FTP messages are responses to FTP commands and consist of a response code followed by explanatory text.

FTP has little security protection when performing file transfer: both user password and the data are exposed to public. To make the file transfer more secure, some enhancements have been made on the FTP, including SFTP, SSH protected FTP and BBFTP.

  • the data that is transferred, it should only be used to transfer small (1-10KB) files containing sensitive data. Large files that do not contain sensitive information should be transferred via a method that does not encrypt data.
  • SSH protected FTP: This transfer method encrypts the passwordinformation but does NOT encrypt the data being transferred. As a result, it should only be used to transfer large (and small) files that do NOT contain sensitive information. File that contain sensitive information should be transferred with SFTP .
  • BBFTP: BBFTP only encryptsusernames and passwords, it does NOT encrypt the data being transferred. BBFTP is a non-interactive FTP-like system that supports parallel TCP streams for data transfers, allowing it to achieve bandwidths that are greater than normal FTP. Because of these characteristics, it is the preferred method for transferring large data files over network.



Protocol Structure - FTP (File Transfer Protocol)

Command

Description

ABOR

Abort data connection process.

ACCT <account>

Account for system privileges.

ALLO <bytes>

Allocate bytes for file storage on server.

APPE <filename>

Append file to file of same name on server.

CDUP <dir path>

Change to parent directory on server.

CWD <dir path>

Change working directory on server.

DELE <filename>

Delete specified file on server.

HELP <command>

Return information on specified command.

LIST <name>

List information if name is a file or list files if name is a directory.

MODE <mode>

Transfer mode (S=stream, B=block, C=compressed).

MKD <directory>

Create specified directory on server.

NLST <directory>

List contents of specified directory.

NOOP

Cause no action other than acknowledgement from server.

PASS <password>

Password for system log-in.

PASV

Request server wait for data connection.

PORT <address>

IP address and two-byte system port ID.

PWD

Display current working directory.

QUIT

Log off from the FTP server.

REIN

Reinitialize connection to log-in status.

REST <offset>

Restart file transfer from given offset.

RETR <filename>

Retrieve (copy) file from server.

RMD <directory>

Remove specified directory on server.

RNFR <old path>

Rename from old path.

RNTO <new path>

Rename to new path.

SITE <params>

Site specific parameters provided by server.

SMNT <pathname>

Mount the specified file structure.

STAT <directory>

Return information on current process or directory.

STOR <filename>

Store (copy) file to server.

STOU <filename>

Store file to server name.

STRU <type>

Data structure (F=file, R=record, P=page).

SYST

Return operating system used by server.

TYPE <data type>

Data type (A=ASCII, E=EBCDIC, I=binary).

USER <username>

User name for system log-in.


Standard FTP messages are as follows:


Response Code

Explanatory Text

110

Restart marker at MARK yyyy=mmmm (new file pointers).

120

Service ready in nnn minutes.

125

Data connection open, transfer starting.

150

Open connection.

200

OK.

202

Command not implemented.

211

(System status reply).

212

(Directory status reply).

213

(File status reply).

214

(Help message reply).

215

(System type reply).

220

Service ready.

221

Log off network.

225

Data connection open.

226

Close data connection.

227

Enter passive mode (IP address, port ID).

230

Log on network.

250

File action completed.

257

Path name created.

331

Password required.

332

Account name required.

350

File action pending.

421

Service shutting down.

425

Cannot open data connection.

426

Connection closed.

450

File unavailable.

451

Local error encountered.

452

Insufficient disk space.

500

Invalid command.

501

Bad parameter.

502

Command not implemented.

503

Bad command sequence.

504

Parameter invalid for command.

530

Not logged onto network.

532

Need account for storing files.

550

File unavailable.

551

Page type unknown.

552

Storage allocation exceeded.

553

File name not allowed.


Related Protocols
TELNET , SFTP, SSH, BBFTP

Sponsor Source

FTP is defined by IETF (http://www.ietf.org ) RFC 959 and updated by 2228, 2640, 2773



Reference

http://www.javvin.com/protocol/rfc959.pdf : FILE TRANSFER PROTOCOL (FTP)