FTP
The File Transfer Protocol (FTP) provides the basic elements of 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.
Commands:
Command | Description | References |
ABOR | Abort a file transfer. |
|
ACCT <account> | Send account information. |
|
ADAT | Authentication/Security Data. | RFC 2228 |
ALLO <bytes> | Allocate. |
|
APPE <filename> | Append to a remote file. |
|
AUTH | Authentication/Security Mechanism. | RFC 2228 |
CCC | Clear Command Channel. | RFC 2228 |
CDUP <dir path> | Change to parent directory. | RFC 959 |
CONF | Confidentiality Protected Command. | RFC 2228 |
CWD <dir path> | Change working directory. | RFC 697 |
DELE <filename> | Delete a remote file. |
|
ENC | Privacy Protected Command. | RFC 2228 |
EPRT | Extended Data port. | RFC 2428 |
EPSV | Extended Passive. | RFC 2428 |
FEAT | Feature. | RFC 2389 |
HELP <command> | Return help on using the server. |
|
HOST <host> | Set virtual host name |
|
LANG | Language negotiation. | RFC 2640 |
LIST <name> | List long dir/file-information. |
|
LPRT | Long data port. | RFC 1639 |
LPSV | Long passive. | RFC 1639 |
MDTM | Return the modification time of a file. |
|
MIC | Integrity Protected Command. | RFC 2228 |
MKD <directory> | Make a remote directory. | RFC 959 |
MLSD <directory> | Name list of remote directory. |
|
MODE <mode> | Set transfer mode. (S=stream, B=block, C=compressed) |
|
NLST <directory> | Name list of remote directory. |
|
NOOP | No operation. |
|
OPTS | Options. | RFC 2389 |
PASS <password> | Send password. |
|
PASV | Enter passive mode. |
|
PBSZ | Protection Buffer Size. | RFC 2228 |
PORT <address> | Open a Data port (h1,h2,h3,h4,p1,p2). |
|
PROT | Data Channel Protection Level. | RFC 2228 |
PWD | Print working directory. | RFC 959 |
QUIT | Logout (terminate the connection). |
|
REIN | Reinitialize the connection. |
|
REST <offset> | Restart. |
|
RETR <filename> | Retrieve a remote file. |
|
RMD <directory> | Remove a remote directory. | RFC 959 |
RNFR <old path> | Rename from. |
|
RNTO <new path> | Rename to. |
|
SITE <params> | Site parameters (site-specific commands). |
|
SIZE <filename> | Return the size of a file . |
|
SMNT <pathname> | Structure mount. | RFC 959 |
STAT <directory> | Return server status. |
|
STOR <filename> | Store a file on the remote host. |
|
STOU <filename> | Store a file unique. | RFC 959 |
STRU <type> | Set file transfer structure (F=file, R=record, P=page). |
|
SYST | return system type. | RFC 959 |
TYPE <data type> | Set transfer type (A=ASCII, E=EBCDIC, I=binary). |
|
USER <username> | Send user name for system log-in. |
|
XCUP | Change to the parent of the current working directory. | RFC 775 |
XMKD | Make a directory. | RFC 775 |
XPWD | Print the current working directory. | RFC 775 |
XRCP | extension to FTP mail (Now incorporated into SMTP, RFC 788) | RFC 743 |
XRMD | Remove the directory. | RFC 775 |
XRSQ | extension to FTP mail (Now incorporated into SMTP, RFC 788) | RFC 743 |
XSEM | Send, Mail if cannot. | RFC 737 |
XSEN | Send to terminal. | RFC 737 |
FTP reply code format:
Code | Description |
1yz | Positive Preliminary reply. |
2yz | Positive Completion reply. |
3yz | Positive Intermediate reply. |
4yz | Transient Negative Completion reply. |
5yz | Permanent Negative Completion reply. |
x0z | Syntax. These replies refer to syntax errors, syntactically correct commands that don't fit any functional category, unimplemented or superfluous commands. |
x1z | Information. These are replies to requests for information, such as status or help. |
x2z | Connections. Replies referring to the control and data connections. |
x3z | Authentication and accounting. Replies for the login process and accounting procedures. |
x4z | File system. These replies indicate the status of the Server file system vis-a-vis the requested transfer or other file system action. |
x5z |
|
FTP reply codes:
Code | Description |
110 | Restart marker reply. |
120 | Service ready in nnn minutes. |
125 | Data connection already open; transfer starting. |
150 | File status okay; about to open data connection. |
200 | Command okay. |
202 | Command not implemented, superfluous at this site. |
211 | (System status, or system help reply.) |
212 | (Directory status reply.) |
213 | (File status reply.) |
214 | (Help message.) |
215 | NAME system type. |
220 | Service ready for new user. |
221 | Service closing control connection. |
225 | Data connection open; no transfer in progress. |
226 | Closing data connection. |
227 | Entering Passive Mode <h1,h2,h3,h4,p1,p2>. |
228 | Entering Long Passive Mode. |
229 | Extended Passive Mode Entered. |
230 | User logged in, proceed. |
250 | Requested file action okay, completed. |
257 | "PATHNAME" created. |
331 | User name okay, need password. |
332 | Need account for login. |
350 | Requested file action pending further information. |
421 | Service not available, closing control connection. |
425 | Can't open data connection. |
426 | Connection closed; transfer aborted. |
450 | Requested file action not taken. |
451 | Requested action aborted. Local error in processing. |
452 | Requested action not taken. File unavailable (file busy) |
500 | Syntax error, command unrecognized. |
501 | Syntax error in parameters or arguments. |
502 | Command not implemented. |
503 | Bad sequence of commands. |
504 | Command not implemented for that parameter. |
521 | Supported address families are <af1, .., afn> |
522 | Protocol not supported. |
530 | Not logged in. |
532 | Need account for storing files. |
550 | Requested action not taken. File unavailable (not found, no access). |
551 | Requested action aborted. Page type unknown. |
552 | Requested file action aborted. |
553 | Requested action not taken. File name not allowed. |
554 | Requested action not taken: invalid REST parameter. |
555 | Requested action not taken: type or stru mismatch. |
LIST information in UNIX-style format:
In following format every entry will send to the client using the UNIX List format.
attribs | links | owner | group | size | date & time/year | name | CR/LF |
spacer (0x20) | 1 byte | |
attribs | attributes of this entry (type/owner/group/anyone) | 10 bytes |
links | link counter (right justified) | 3..5 bytes |
owner | owner name (left justified) | 8..10 bytes |
group | group name (left justified) | 8..10 bytes |
size | size of this entry (right justified) | 7..10 bytes |
date & time/year | creation/last-change date & time/year (left justified) | 12 bytes |
name | name of this entry (no filling) | 1..255 bytes |
CR/LF | end-of-line (0x0D & 0x0A) | 2 byte |
attributes :
type | owner | group | anyone |
- | r w x | r w x | r w x |
• type (first character)
- | the entry is a ordinary file |
b | the entry is a block special file |
c | the entry is a character special file |
d | the entry is a directory |
l | the entry is a symbolic link |
p | the entry is a FiFo special file (pipe) |
s | the entry is a local socket |
• owner / group / anyone (a 3 bytes)
r | read |
w | write (edit) |
x | execute (search) |
- | corresponding permission not granted |
link counter :
The number of links to this entry. The size of this field is 3..5 characters with blanks plus right justified value, like " 1".
owner name :
The name of the owner of this entry. This is the user profile name of the entry-owner. The size of this field is 8..10 characters with the left justified name-string plus filling blanks, like "ftp ".
group name :
The name of the group of this entry. This is the group profile name of the entry. The size of this field is 8..10 characters with the left justified name-string plus filling blanks, like "service ".
size :
The size of this entry in bytes. The size of this field itself is 7..10 characters with blanks plus right justified value in decimal characters, like " 1024". Directories alltimes have a size of 0.
date & time/year :
The modification time of this entry. The size of this field is fix 12 characters with left justified value in following format.
• last modification in the previous 180 days
"Mmm dd hh:mm"
• last modification not in the previous 180 days
"Mmm dd yyyy"
with the following description of the elements:
Mmm | abbreviated month ("Jan", Feb", ..) |
dd | day of the month, right justified and padded with blank (" 1" .. "31") |
hh | hour, right justified and padded with ZERO ("00" .. "23") |
mm | minute, right justified and padded with ZERO ("00" .. "59") |
yyyy | year, right justified but alltimes 4 characters ("1980" ..) |
name :
The name of this entry. This field have a vaiable length, depends on the name of this entry and can includes blanks. After this field the line (this entry) will closed (without a spacer) with a CR+LF.
example:
"drwxr--r-- 1 ftp service 0 Jul 8 2005 images"
"-rw-r--r-- 1 ftp service 2038 Aug 16 09:23 index.html"