Overview
This node enables file upload operations over an SSH connection to a remote server. It is designed to securely transfer files from the n8n workflow environment to a specified directory on a remote machine using SSH protocols. The node supports two types of authentication: password-based and private key-based, and it can connect either via stored credentials or dynamic parameters provided at runtime.
Common scenarios where this node is beneficial include:
- Automating deployment workflows by uploading build artifacts or configuration files to remote servers.
- Integrating with legacy systems that only accept file inputs via SSH.
- Securely transferring sensitive files without exposing them over less secure protocols.
For example, you might use this node to upload a generated report or image from your workflow directly into a user's home directory on a remote Linux server for further processing.
Properties
| Name | Meaning |
|---|---|
| Connection Type | Choose how to provide SSH connection details: - Credentials: Use stored credentials configured in n8n. - Dynamic Parameters: Provide host, port, username, and authentication details dynamically per execution. |
| Authentication | Select the authentication method: - Password: Authenticate using a password. - Private Key: Authenticate using an SSH private key (optionally with a passphrase). |
| Host | The hostname or IP address of the SSH server (required if using Dynamic Parameters). |
| Port | The port number of the SSH server (default 22; required if using Dynamic Parameters). |
| Username | The username to authenticate as on the SSH server (required if using Dynamic Parameters). |
| Password | The password for authentication (required if using Dynamic Parameters and Password authentication). |
| Private Key | The private key string used for authentication (required if using Dynamic Parameters and Private Key authentication). |
| Passphrase | Optional passphrase for the private key (used only with Private Key authentication). |
| Input Binary Field | The name of the binary input field containing the file data to be uploaded. This must match the binary property name in the incoming item. |
| Target Directory | The remote directory path where the file will be uploaded. The filename is taken from the binary data's original filename unless overridden. |
| Options | Additional options for the upload operation: - File Name: Override the filename used when uploading the file. |
Output
The node outputs JSON objects indicating the success or failure of each upload operation:
- On successful upload, the output JSON contains:
{ "success": true } - If an error occurs during upload, the output JSON contains an
errorfield with the error message:{ "error": "Error message describing what went wrong" }
The output items are paired with their corresponding input items to maintain traceability.
No binary data is output by this node since its purpose is to send files to a remote server.
Dependencies
- Requires an SSH server accessible from the n8n instance.
- Needs either stored SSH credentials or dynamic SSH connection parameters including host, port, username, and authentication (password or private key).
- Uses the
node-sshlibrary internally to manage SSH connections and file transfers. - Temporary local files are created during upload using a temporary file utility and cleaned up after the operation.
Troubleshooting
- Connection failures: Errors such as "SSH connection failed" usually indicate incorrect host, port, username, or authentication details. Verify credentials and network accessibility.
- Permission denied: Ensure the user has write permissions to the target directory on the remote server.
- Invalid path errors: Paths starting with
~must be properly expanded; the node replaces~/with the actual home directory but does not support bare~. Use full absolute paths or~/notation. - Missing binary data: The node expects binary data in the specified input binary field. If missing or incorrectly named, the upload will fail.
- File name issues: If the file name is not correctly set in the binary data or overridden in options, the upload may fail or save under an unexpected name.
To resolve these issues, double-check all input parameters, ensure the SSH server is reachable, and verify file and directory permissions.