SSH V2

Execute commands via SSH

Actions3

Overview

This node enables executing SSH commands and transferring files over SSH connections. Specifically, the File - Download operation allows users to download a file from a remote SSH server to the n8n workflow. It supports connecting either via stored credentials or dynamic parameters, with authentication by password or private key.

Common scenarios include:

  • Automating retrieval of log files, reports, or data exports from remote servers.
  • Integrating legacy systems that expose files only via SSH.
  • Periodically downloading backups or configuration files for further processing in workflows.

Example: Downloading a remote invoice file /home/user/invoice.txt and using it as binary data in subsequent workflow nodes.

Properties

Name Meaning
Connection Type Choose between using stored credentials or specifying connection parameters dynamically.
Authentication Select authentication method: Password or Private Key.
Host (Dynamic parameters only) SSH server hostname or IP address.
Port (Dynamic parameters only) SSH server port number (default 22).
Username (Dynamic parameters only) Username for SSH authentication.
Password (Dynamic parameters + Password auth) Password for SSH authentication.
Private Key (Dynamic parameters + Private Key auth) Private key string used for SSH authentication.
Passphrase (Dynamic parameters + Private Key auth) Optional passphrase for the private key.
Path Full path including filename of the remote file to download (e.g., /home/user/invoice.txt).
File Property Name of the output binary property where the downloaded file content will be stored (default data).
Options → File Name Optional override for the binary data file name instead of using the original remote file name.

Output

The node outputs the downloaded file as binary data attached to each input item:

  • The binary data is stored under the specified "File Property" name (default "data").
  • The binary object contains the file content, accessible by downstream nodes for processing, saving, or uploading elsewhere.
  • The JSON part of the output item remains unchanged except for adding the binary data.
  • If multiple items are processed, each item's corresponding file is downloaded and attached individually.

Dependencies

  • Requires an SSH server accessible with provided credentials or parameters.
  • Needs either stored SSH credentials or dynamic connection details (host, port, username, password/private key).
  • Uses the node-ssh library internally to manage SSH connections and file transfers.
  • Temporary local files are created during download using a temporary file utility and cleaned up afterward.

Troubleshooting

  • Invalid path errors: Paths starting with ~ must be replaced with full home directory paths or start with ~/. Using just ~ alone causes an error.
  • Connection failures: Ensure correct host, port, username, and authentication details. Network issues or firewall restrictions can block SSH connections.
  • Authentication errors: Verify password or private key correctness. For private keys, ensure proper formatting and provide passphrase if required.
  • File not found: Confirm the remote file path is correct and accessible by the SSH user.
  • Permission denied: The SSH user must have read permissions on the target file.
  • Binary property conflicts: Make sure the chosen binary property name does not conflict with existing properties in the workflow data.

To resolve errors, check the error messages returned by the node, verify credentials and paths, and test connectivity independently if needed.

Links and References

Discussion