Overview
This node enables executing SSH commands and transferring files over SSH connections. It supports two main resource types: running shell commands remotely and uploading/downloading files via SSH. Users can authenticate either with stored credentials or by providing connection parameters dynamically, using password or private key authentication.
Common scenarios include:
- Automating remote server management by running shell commands.
- Transferring files securely between local and remote machines.
- Integrating SSH operations into workflows for deployment, backups, or remote monitoring.
Practical examples:
- Execute a script on a remote Linux server to gather system metrics.
- Upload configuration files to a remote device before restarting services.
- Download log files from a remote host for analysis.
Properties
| Name | Meaning |
|---|---|
| Connection Type | Choose between using stored credentials or dynamic parameters for the SSH connection. |
| Authentication | Select authentication method: Password or Private Key. |
| Host | (Dynamic parameters only) Hostname or IP address of the SSH server. |
| Port | (Dynamic parameters only) Port number of the SSH server (default 22). |
| Username | (Dynamic parameters only) Username for SSH authentication. |
| Password | (Dynamic parameters + Password auth only) Password for SSH authentication. |
| Private Key | (Dynamic parameters + Private Key auth only) Private key content used for SSH authentication. |
| Passphrase | (Dynamic parameters + Private Key auth only) Passphrase for the private key if it is encrypted. |
Output
The node outputs JSON data structured according to the operation performed:
Command Execution:
The output JSON contains the result of the executed command with fields such asstdoutandstderr. Each item corresponds to one input item, paired accordingly.File Download:
The output includes the original JSON data plus a binary property containing the downloaded file's contents. The binary property name is configurable. The file is saved temporarily during execution and then attached as binary data.File Upload:
The output JSON confirms success with{ "success": true }for each uploaded file.
Binary data handling is supported for file transfers, enabling seamless integration with other nodes that consume or produce binary files.
Dependencies
- Requires an SSH server accessible from the n8n instance.
- Supports authentication via password or private key; appropriate credentials must be configured or provided.
- Uses the
node-sshlibrary internally for SSH connections. - Temporary files are managed using
tmp-promiseand Node.js filesystem promises. - For private key authentication, keys are formatted properly before use.
Troubleshooting
Connection failures:
Errors like "SSH connection failed" usually indicate incorrect host, port, username, or authentication details. Verify credentials and network accessibility.Invalid path errors:
Paths starting with~but not followed by/are rejected. Use full paths or~/to represent home directory.Permission issues:
When uploading or downloading files, ensure the SSH user has proper permissions on the target directories.Binary data errors:
Upload operations require valid binary input data. If missing or incorrectly referenced, the node will throw errors.Private key formatting:
Private keys must be correctly formatted PEM strings. Improper formatting or missing passphrases cause authentication failures.
To resolve errors, check the error messages returned in the node output or credential test results, adjust parameters accordingly, and ensure the SSH server is reachable.
Links and References
- node-ssh GitHub repository – underlying SSH client library used.
- SSH basics – general information about SSH protocol.
- n8n documentation on binary data – handling binary files in n8n workflows.