## ProFTPD module `mod_copy`

The `mod_copy` module implements `SITE CPFR` and `SITE CPTO` commands (analogous to `RNFR` and `RNTO`), which can be used to copy files/directories from one place to another on the server without having to transfer the data to the client and back.

This module is contained in the `mod_copy.c` file for ProFTPD 1.3.x, and is not compiled by default. Installation instructions are discussed here.

The most current version of `mod_copy` is distributed with the ProFTPD source code.

## Author

Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.

## Directives

- CopyEngine
- CopyOptions

## `SITE` Commands

- SITE CPFR
- SITE CPTO

### CopyEngine

Syntax: CopyEngine on|off
Default: CopyEngine on
Context: server config, `<VirtualHost>`, `<Global>`
Module: mod_copy
Compatibility: 1.3.6rc1 and later

The `CopyEngine` directive enables or disables the module's handling of `SITE COPY` et al commands. If it is set to off this module ignores these commands.

### CopyOptions

Syntax: CopyOptions opt1 ...
Default: None
Context: server config, `<VirtualHost>`, `<Global>`
Module: mod_copy
Compatibility: 1.3.6rc3 and later

The `CopyOptions` directive is used to configure various optional behavior of `mod_copy`.

The currently implemented options are:

- `NoDeleteOnFailure`

  The `mod_copy` file, when a copying operation fails, will delete the destination file by default. If, however, you do want to keep that destination file when a failure happens, use this option.

### SITE CPFR

This `SITE` command specifies the source file/directory to use for copying from one place to another directly on the server.

The syntax for `SITE CPFR` is:

      SITE CPFR source-path

See also: SITE CPTO

### SITE CPTO

This `SITE` command specifies the destination file/directory to use for copying from one place to another directly on the server.

The syntax for `SITE CPTO` is:

      SITE CPTO destination-path

A client wishing to copy a file/directory first sends a `SITE CPFR` command, then a `SITE CPTO`; this is similar to how renames are handled using `RNFR` and `RNTO`.

Use of these `SITE` command can be controlled via `<Limit>` sections, e.g.:

      <Limit SITE_COPY>
        AllowUser alex
        DenyAll
      </Limit>

See also: SITE CPFR

Logging
The `mod_copy` module supports trace logging, via the module-specific log channels:

- copy

Thus for trace logging, to aid in debugging, you would use the following in your `proftpd.conf`:

      TraceLog /path/to/ftpd/trace.log
      Trace copy:20

This trace logging can generate large files; it is intended for debugging use only, and should be removed from any production configuration.

## Installation

The `mod_copy` module is distributed with ProFTPD. Simply follow the normal steps for using third-party modules in ProFTPD. For including `mod_copy` as a statically linked module:

      $ ./configure --with-modules=mod_copy

To build `mod_copy` as a DSO module:

      $ ./configure --enable-dso --with-shared=mod_copy

Then follow the usual steps:

      $ make
      $ make install

For those with an existing ProFTPD installation, you can use the `prxs` tool to add `mod_copy`, as a DSO module, to your existing server:

      $ prxs -c -i -d mod_copy.c

© Copyright 2009-2017 TJ Saunders
All Rights Reserved