Strip Prefix
The devel
, the user can request the file devel_procman.tar.gz
by the command get procman.tar.gz
, and the FTP server performs any other rules that apply to that file and retrieve it from the server. Although this feature is documented, as of version 2.6.2, it has yet to be implemented.
Strip Postfix
The .gz
extension from a file that was TARed and GZIPed when the server performed automatic decompression before sending the file to the client.
Add-On Prefix
The procman.tar.gz.
The server has a conversion rule to add a prefix of gnome
to all .tar.gz
files; therefore the server would append this string to the file before sending it to the client. The user would receive a file called gnome_procman.tar.gz
. Keywords such as uppercase
and lowercase
can be used in this function to change the case of the filename for those operating systems in which case makes a difference. As with the strip prefix conversion, this feature is not yet implemented in version 2.6.2.
Add-On Postfix
An .gz
extension after the file was compressed, and then send that file to the client. The server could also perform the same action for uncompressed files sent to the server. This would have the effect of conserving disk space on the server.
External Command
The external command entries in the ftpconversions
file contain the bulk of the FTP server conversion rules. The external command entry tells the server what should be done with a file after it is transferred to the server. The specified conversion utility can be any command on the server, although generally it is a compression utility. As the file is sent, the server passes the file through the external command. If the file is being uploaded to the server, the command needs to send the result to standard in, whereas a download sends the result to standard out. For example, here is an entry specifying the tar
command:
: : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
The following sections describe the fields in a conversion entry.
You must use the types field of the ftpconversions file to tell the server to what types of files the conversion rules apply. Separate the file type entries with the (|
) character, and give each type
a value of T_REG
, T_ASCII
, and T_DIR
.
T_REG signifies a regular file, T_ASCII an ASCII file, and T_DIR a directory. A typical entry is T_REG | T_ASCII, which signifies a regular ASCII file.
The options field informs the server what action is being done to the file. Similar to the types field, options are separated by the (|
) character. Here are the valid ranges you can assign to items in the options field:
> O_COMPRESS
to compress the file
> O_UNCOMPRESS
to uncompress the file
> O_TAR
to tar the file
An example of this field is O_COMPRESS | O_TAR
, where files are both compressed and TARed.
The description field allows an administrator to quickly understand what the rule is doing. This field does not have any syntax restriction, although it is usually a one-word entry—such as TAR
, TAR+COMPRESS
, or UNCOMPRESS
— which is enough to get the concept across.
An Example of Conversions in Action
Crafting complex conversion entries is a task perhaps best left to the Linux/Unix expert, but the sample ftpconversions
file included with wu-ftpd
provides more than enough examples for the average Red Hat administrator. Building your own simple conversion entry is not really too difficult, so let's examine and decode an example:
:.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
In this example, the strip prefix (field 1) is null
because it is not yet implemented, so this rule does not apply to prefixes. The second field of this rule contains the .Z
postfix; therefore it deals with files that have been compressed with the compress
utility. The rule does not address the add-on prefix or postfix, so fields 3 and 4 are null
. Field 5, the external command field, tells the server to run the compress
utility to decompress all files that have the .Z
extension, as the -d
parameter signifies. The -c
options tells compress
to write its output to standard out, which is the server in this case. The %s
is the name of the file against which the rule was applied. Field 6 specifies that this file is a regular file in ASCII format. Field 7, the options field, tells the server that this command uncompresses the file. Finally, the last field is a comment that gives the administrator a quick decode of what the conversion rule is doing — that is, uncompressing the file.
Several conversion rules may be specified in wu-ftpd
's default