FTP/FTPS with TLS

FTP/FTPS with TLS support

Overview

This node provides FTP, FTPS (FTP over TLS), and SFTP file operations with TLS support. It allows users to interact with remote servers to list, download, upload, delete, or rename files and folders securely.

Common scenarios where this node is beneficial include:

  • Automating file management on remote servers.
  • Integrating secure file transfers into workflows.
  • Periodically cleaning up or organizing files on FTP/SFTP servers.
  • Downloading files from a server for further processing in n8n.
  • Uploading generated reports or data files to a remote location.

For example, you can use the "Delete" operation to remove files or directories from a remote FTP server, optionally recursively deleting all contents within a directory.

Properties

Name Meaning
Path The remote path to operate on (file or folder path on the FTP/SFTP server).
Recursive Whether to perform the operation recursively (applicable for "list" and "delete").

Output

The output JSON structure varies depending on the operation:

  • Delete Operation:
    Returns an object indicating success and a message describing what was deleted. For example:

    {
      "success": true,
      "message": "File deleted: /path/to/file"
    }
    

    If recursive deletion is enabled and a directory is deleted, the message reflects that accordingly.

  • General Structure:
    Each execution returns an array of objects with a json property containing the result or an error message if the operation failed.

  • Binary Data:
    Although not relevant for the Delete operation, other operations like Download and Upload handle binary data representing file contents encoded in base64 with associated metadata such as MIME type and filename.

Dependencies

  • Requires credentials for connecting to the FTP/FTPS/SFTP server, including host, port, username, password/private key, and optional TLS settings.
  • Uses external libraries:
    • basic-ftp for FTP and FTPS connections.
    • ssh2-sftp-client for SFTP connections.
  • Node requires proper configuration of these credentials and network access to the target server.

Troubleshooting

  • Common Issues:

    • Connection failures due to incorrect host, port, or authentication details.
    • Permission errors when attempting to delete files or directories without sufficient rights.
    • Recursive deletion failing if the path is not a directory or if permissions are insufficient.
    • TLS handshake errors if server certificates are invalid or incompatible TLS versions are used.
  • Error Messages:

    • "FTP operation failed: <error message>" or "SFTP operation failed: <error message>": Indicates failure during the respective protocol operation. Check credentials, network connectivity, and path correctness.
    • "Unknown operation: <operation>": The specified operation is not supported; verify the operation parameter.
    • Errors related to recursive deletion usually mean the path is not a directory or the recursive flag is missing.
  • Resolution Tips:

    • Verify all credential details and ensure the server is reachable.
    • Confirm the user has appropriate permissions on the remote server.
    • Use correct paths and set the recursive flag appropriately when deleting directories.
    • Adjust TLS settings or disable strict certificate checks if encountering TLS errors (not recommended for production).

Links and References

Discussion