mod_xfer
The mod_xfer
module handles most of the FTP commands related to
file transfers.
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The MaxRetrieveFileSize
directive sets a maximum limit on the
size of a single file downloaded from proftpd
. If the
requested file size is larger than than the configured maximum limit,
the data transfer will be rejected.
A single "*" argument configures unlimited file sizes, and is used primarily to override any inherited restrictions from higher-level configuration sections. The given number is the number of bytes for the limit, and is followed by a units specifier of (case-insensitive) "Gb" (Gigabytes), "Mb" (Megabytes), "Kb" (Kilobytes), or "B" (bytes). The given number of bytes is multiplied by the appropriate factor.
The optional parameters are used to restrict the file size limits only to specific users. If the "user" restriction is given, then expression is a user-expression specifying to which users the rule applies. Similarly for the "group" restriction. For the "class" restriction, the expression is simply the name of connection class for whom the rule will apply. If no matching user, group, or class expression (in that order) is found for the current user, then a limit with no expression (i.e. no "user", "group", or "class" identifier) is applied.
Examples: # Restrict downloads to only 1 gigabyte MaxRetrieveFileSize 1 Gb # Restrict downloads for user fred, but allow unlimited download size for # everyone else MaxRetrieveFileSize 50 Kb user fred MaxRetrieveFileSize *
See also: MaxStoreFileSize
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The MaxStoreFileSize
directive sets a maximum limit on the
size of a single file uploaded to proftpd
. When the
configured maximum limit is reached, the data transfer will be aborted.
A single "*" argument configures unlimited file sizes, and is used primarily to override any inherited restrictions from higher-level configuration sections. The given number is the number of bytes for the limit, and is followed by a units specifier of (case-insensitive) "Gb" (Gigabytes), "Mb" (Megabytes), "Kb" (Kilobytes), or "B" (bytes). The given number of bytes is multiplied by the appropriate factor.
The optional parameters are used to restrict the file size limits only to specific users. If the "user" restriction is given, then expression is a user-expression specifying to which users the rule applies. Similarly for the "group" restriction. For the "class" restriction, the expression is simply the name of connection class for whom the rule will apply. If no matching user, group, or class expression (in that order) is found for the current user, then a limit with no expression (i.e. no "user", "group", or "class" identifier) is applied.
Examples:
# Restrict upload to only 3 megabytes MaxStoreFileSize 3 Mb # Restrict anonymous uploads to 50k, but allow unlimited upload size for # everyone else MaxStoreFileSize 50 Kb user anonymous MaxStoreFileSize *
NOTE: In FTP uploads, the size of the file being uploaded is not
sent to the FTP server first; this means that the FTP server does not know in
advance how much data the FTP client is going to send. The FTP server can only
count the number of bytes being uploaded, and stop the transfer when a
configured limit is reached. This means that MaxStoreFileSize
cannot be used to prevent an FTP client from even sending the bytes
over the network.
See also: MaxRetrieveFileSize
<VirtualHost>
, <Global>
, <Anonymous>
The TransferPriority
directive is used to tweak the process
priority (a la nice(1)
) of the session during data
transfers. For example, large (or anonymous) data transfers can be configured
to have lower priorities, so as to get lower priority than other applications
from the kernel.
The priority parameter can one of the convenient "high", "medium", or
"low" keywords, or it can be an explicit number. As per the
nice(1)
man page, the higher the number, the lower the priority;
the highest priority is -20, and the lower priority is 19.
Examples:
# All data transfers get a low priority TransferPriority APPE,RETR,STOR lowOr maybe only downloads should have lower priorities, but uploads should be fine:
TransferPriority RETR low
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The TransferRate
directive is used to set transfer rate limits
on the transfer of data. This directive allows for transfer rates to be set
in a wide variety of contexts, on a per-command basis, and for certain subsets
of users (via
mod_ifsession
).
Note that these limits only apply to an individual session, and
do not apply to the overall transfer rate of the entire daemon.
The cmd-list parameter may be an comma-separated list of any of the
following commands: APPE
, RETR
, STOR
,
and STOU
.
The kbytes-per-sec parameter is the actual transfer rate to be applied.
The free-bytes parameter, if configured, allows that number of bytes to be transferred before the rate limit is applied. This allows for clients transferring small files to be unthrottled, but for larger files, such as MP3s and ISO images, to be throttled.
Here are some examples:
# Limit downloads for everyone TransferRate RETR 1.5 # Limit uploads (and appends!) to the prolific users in the # lotsofuploadfiles.net domain. This presumes that a Class has been defined # for that domain, and that that Class has been named "uploaders". Let them # upload small files without throttling, though. <IfClass uploaders> TransferRate APPE,STOR 8.0:1024 </IfClass>
<VirtualHost>
, <Global>
, <Anonymous>
, <Directory>
, .ftpaccess
The UseSendfile
directive controls use of sendfile(2)
functionality, which is an optimization for sending files to clients. Use of
sendfile(2)
functionality avoids separate read and send kernel
operations, and buffer allocations. Read this
howto for more details.
mod_xfer
module is always installed.