Skip to content

Supported FTP commands

HELP and FEAT list what the server supports. The command names are not case sensitive.

Login and security

Command Meaning
USER <name> Start the login as <name>.
PASS <password> The password of the user.
ACCT Not implemented (502).
REIN, STOU, SMNT Defined by RFC 959 and not implemented (502).
AUTH TLS Switch the control connection to TLS (explicit FTPS, RFC 4217). Needs a build with OpenSSL.
PBSZ 0 Protection buffer size, required by TLS and accepted with 0.
PROT C, PROT P Data connection in clear text (C) or protected by TLS (P).
CCC Switch the control connection back to clear text.
QUIT Close the connection.

Information

Command Meaning
FEAT The extensions of the server.
OPTS Options of an extension: OPTS UTF8 ON, OPTS MLST <facts>.
SYST Type of the system (UNIX Type: L8).
HELP The list of commands.
NOOP Does nothing; keeps the connection open.
STAT Without argument, the status of the connection. With a path, the listing of the path on the control connection.
LANG Language of the replies (RFC 2640): English only.
HOST Accepted and ignored: uFTP has no virtual hosts (RFC 7151).
Command Meaning
PWD, XPWD The current directory.
CWD <path> Change directory.
CDUP, XCUP Go to the parent directory.
LIST [path] Detailed listing: permissions, owner, group, size, date.
NLST [path] Names only.
MLSD [path] Machine readable listing of a directory (RFC 3659).
MLST [path] The same facts of one file or directory, on the control connection.

OPTS MLST type;size;modify;perm;unix.mode;unix.uid;unix.gid chooses the facts of MLST and MLSD.

Transfers

Command Meaning
PASV, EPSV Passive mode: the server opens a port and the client connects (EPSV carries only the port; EPSV ALL refuses the other modes).
PORT, EPRT Active mode: the server connects to the address of the client.
TYPE A, TYPE I Accepted; the data is always transferred as binary (no line end conversion): see Text files.
STRU F, STRU R File structure (default) or record structure in stream mode. STRU P is not implemented.
MODE S Stream mode. Other modes answer 504.
RETR <path> Download a file.
STOR <path> Upload a file.
APPE <path> Append to a file.
REST <offset> Resume a download or an upload from a byte offset.
ABOR Abort the transfer in progress.
ALLO Accepted and ignored (202).

Files and directories

Command Meaning
SIZE <path> The size of a file in bytes.
MDTM <path> The modification time of a file.
MKD <path>, XMKD Create a directory.
RMD <path>, XRMD Remove an empty directory (not the home itself).
DELE <path> Delete a file.
RNFR <path>, RNTO <path> Rename: RNFR names the source and RNTO the target.
SITE CHMOD <mode> <path> Change the permissions of a file. The setuid and setgid bits are refused, and you must be allowed to write the file.
SITE HELP The list of the SITE commands.

With an owner configured for the user, deleting and renaming (DELE, RMD, RNFR, RNTO) need to write the file and the directory that holds it. See Permissions.

Checksums and dates

Command Meaning
MFMT <YYYYMMDDHHMMSS> <path> Set the modification time of a file (UTC). Used by clients that keep the dates when they upload. Needs the permission overwrite.
HASH <path>, OPTS HASH [name] The checksum of a file without downloading it: 213 SHA-256 0-<last byte> <hash> <path>. The algorithm is SHA-256 (also SHA-1 and MD5, chosen with OPTS HASH); FEAT marks the current one with *.
XCRC <path>, XMD5 <path>, XSHA1 <path>, XSHA256 <path> The same for the clients that use these older commands: 250 <hash> (CRC-32 in hexadecimal for XCRC).

The checksum commands read the whole file, so they work only up to HASH_MAX_SIZE_MB (default 256 MB, 552 above it; 0 turns them off). They need the permission download, and to be able to read the file like RETR; MFMT needs to be able to write it. The checksum of a file that did not change is kept, so the second request is immediate. MD5 and SHA-1 are there because clients ask for them: for a check against corruption, not against an attacker.

A command that takes seconds (a checksum, STAT of a path, the PAM check of a password) runs in a thread of its own: the other clients are not kept waiting. The client that asked waits for its reply, and its replies stay in the order of its commands (what it sends meanwhile is processed afterwards).

Running scripts

Command Meaning
SITE RUN <name> [parameter], SITE STATUS [id] Start one of the programs the administrator listed, in the background, and ask how it went. Needs the permission run; off unless SITE_COMMAND_<name> is set. See Run scripts.

Text files: TYPE A

uFTP accepts TYPE A (ASCII) but does not convert line ends: every file is stored and sent byte by byte, as with TYPE I. RFC 959 would have the server send text with CR LF and store it with the line ends of its system.

It is a choice. A conversion applied to a file that is not text (an archive, an image, a database) breaks it without an error, and for the RFC TYPE A is the type of a client that does not ask for another. Without it a file is the same on the two sides, SIZE and the checksums are the ones of the file on the disk, and an interrupted transfer can be resumed.

If you need other line ends, convert the file before the upload or after the download (unix2dos, dos2unix). Nearly all the editors of today read both.

Reply codes you may see

Code Meaning
150 The data connection is open, the transfer starts.
226 The transfer is complete.
250 The command worked.
421 The server is full, the limit of connections or of connections per minute is reached, or too many PAM logins are in progress.
425 The data connection could not be opened, or PROT changed after it was opened.
426 The transfer was interrupted (also by a new USER, which then gets its 331, or by a TLS error).
450 Temporary error: too many slow commands (HASH, STAT of a path) are running, or for instance the directory of an upload is still being created by another connection. The client can retry.
452 The disk is below MIN_FREE_SPACE_MB.
503 Commands out of order: RNTO that does not come right after RNFR (only NOOP and STAT can be in between), PASS without a new USER when you are logged in.
530 Not logged in, or wrong user name or password.
550 The file or directory does not exist or you are not allowed to use it.