Overview
This node enables executing SSH commands and transferring files over SSH using the KingSSH client. Specifically, for the File - Download operation, it connects to a remote server via SSH, downloads a specified file from the remote path, and outputs the file data as binary within the workflow.
Common scenarios where this node is beneficial include:
- Automating retrieval of log files or reports from remote servers.
- Integrating remote file contents into workflows for further processing.
- Backing up remote files by downloading them to local storage or passing them downstream in n8n.
Example: Download a configuration file /etc/nginx/nginx.conf from a remote Linux server and use its content in subsequent nodes for validation or modification.
Properties
| Name | Meaning |
|---|---|
| Remote File Path | The full path to the file on the remote SSH server that you want to download. |
| Local File Path | The intended local path for the downloaded file (used for reference; file is output as binary). |
| Binary Property | The name of the binary property in which the downloaded file's data will be stored. |
Output
The node outputs an array with one item per input. Each item contains:
jsonobject with:fileName: The base name of the downloaded file.remotePath: The remote file path used for download.localPath: The local file path provided in input.success: Boolean indicating if the download succeeded.
binaryobject with:- A property named as specified by the "Binary Property" input, containing the binary data of the downloaded file ready for use in subsequent nodes.
Dependencies
- Requires an active SSH connection to the target server.
- Needs credentials including host, port, username, and either password or private key authentication.
- Uses the
ssh2Node.js library internally to handle SSH and SFTP operations. - The node expects proper SSH credentials configured in n8n (an API key credential or equivalent).
Troubleshooting
- Connection errors: If the node fails to connect, verify SSH credentials, network accessibility, and firewall settings.
- Permission denied: Ensure the SSH user has read permissions for the specified remote file.
- File not found: Confirm the remote file path is correct and accessible.
- SFTP initialization failure: Indicates issues establishing the SFTP subsystem; check server support and SSH configuration.
- Binary data issues: Make sure the "Binary Property" name does not conflict with other properties and is correctly referenced downstream.
If the node throws errors like KingSSH connection error, Failed to initialize SFTP, or Failed to read file, review the error message details and adjust credentials, paths, or server settings accordingly.