KingSSH

Execute commands via KingSSH

Actions3

Overview

This node enables file upload operations over SSH using the SFTP protocol. It connects to a remote server via SSH and uploads a local file's binary data to a specified remote path. This is useful for automating deployment tasks, transferring files to remote servers, or integrating with systems that require secure file transfer.

Practical examples:

  • Uploading configuration files to a remote Linux server.
  • Deploying static assets to a web server.
  • Transferring backup files securely to a remote location.

Properties

Name Meaning
Remote File Path The full path on the remote server where the file will be uploaded (e.g., /path/to/remote/file).
Local File Path The local file system path of the file to be uploaded (e.g., /path/to/local/file).
Binary Property The name of the binary property in the input data that contains the file content to upload.

Output

The node outputs a JSON object with the following structure:

  • fileName: The name of the uploaded file (extracted from the remote path).
  • remotePath: The remote file path where the file was uploaded.
  • localPath: The local file path provided as input.
  • success: A boolean indicating whether the upload succeeded (true).

No binary data is output by this operation.

Example output JSON:

{
  "fileName": "example.txt",
  "remotePath": "/remote/path/example.txt",
  "localPath": "/local/path/example.txt",
  "success": true
}

Dependencies

  • Requires an SSH connection to the target server with valid credentials (host, port, username, password or private key).
  • Uses the ssh2 Node.js library internally to establish SSH and SFTP connections.
  • The node expects an API key credential or equivalent SSH authentication configured in n8n for connecting to the remote host.

Troubleshooting

  • Connection errors: If the node fails to connect, verify SSH credentials, host address, port, and network accessibility.
  • Permission denied: Ensure the user has write permissions on the remote directory.
  • File not found locally: Confirm the local file path is correct and accessible by n8n.
  • Binary property missing or invalid: Make sure the binary property specified contains valid base64-encoded file data.
  • Common error messages:
    • KingSSH connection error: Indicates issues establishing the SSH connection.
    • Failed to initialize SFTP: Problems initializing the SFTP subsystem.
    • Failed to write file: Errors during file upload, often due to permissions or path issues.

To resolve these, double-check credentials, paths, and permissions on both local and remote systems.

Links and References

Discussion