SSH V2

Execute commands via SSH

Actions3

Overview

This node enables file upload operations over SSH (Secure Shell) to a remote server. It connects to an SSH server using either stored credentials or dynamic parameters, authenticating via password or private key. The node uploads binary files from the workflow input to a specified directory on the remote machine.

Common scenarios:

  • Automating deployment of files to remote servers.
  • Uploading configuration files or scripts to Linux/Unix servers.
  • Integrating with legacy systems that only support SSH file transfers.
  • Securely transferring sensitive files within automated workflows.

Practical example:
You have a generated report in your workflow as binary data and want to upload it to a remote server's /home/user/reports directory for further processing. This node can securely transfer the file using SSH without manual intervention.


Properties

Name Meaning
Connection Type Choose how to provide connection details:
- Credentials: Use stored SSH credentials.
- Dynamic Parameters: Enter host, port, username, and authentication info manually.
Authentication Method to authenticate with the SSH server:
- Password
- Private Key
Host Hostname or IP address of the SSH server (required if using Dynamic Parameters).
Port Port number of the SSH server (default 22, required if using Dynamic Parameters).
Username Username for SSH authentication (required if using Dynamic Parameters).
Password Password for SSH authentication (required if using Dynamic Parameters and Password authentication).
Private Key Private key string for SSH authentication (required if using Dynamic Parameters and Private Key authentication).
Passphrase Optional passphrase for the private key (used with Private Key authentication).
Input Binary Field The name of the binary property in the input data that contains the file to be uploaded (e.g., "data").
Target Directory Remote directory path where the file will be uploaded (e.g., /home/user). The filename is taken from the binary data unless overridden.
Options → File Name Optional override for the filename used when uploading. If not set, the original binary file name is used.

Output

The node outputs JSON objects indicating success or failure for each uploaded file:

  • On successful upload:
    {
      "success": true
    }
    
  • On failure (if continueOnFail is enabled), the output includes an error message:
    {
      "error": "Error message describing what went wrong"
    }
    

No binary data is output by this operation.


Dependencies

  • Requires an SSH server accessible from the n8n instance.
  • Needs either stored SSH credentials or dynamic SSH connection parameters.
  • Uses the node-ssh library internally to manage SSH connections and file transfers.
  • Temporary local files are created during upload using a temporary file utility.
  • No additional environment variables are explicitly required beyond standard SSH access credentials.

Troubleshooting

  • Connection failures:
    Errors like "SSH connection failed" usually indicate incorrect host, port, username, password/private key, or network issues. Verify all connection parameters and ensure the SSH server is reachable.

  • Authentication errors:
    Ensure the correct authentication method is selected and credentials are valid. For private keys, confirm the key format and passphrase correctness.

  • File upload errors:

    • Check that the target directory exists and the user has write permissions on the remote server.
    • If the filename override is used, ensure it does not contain invalid characters or paths.
  • Invalid path errors:
    Paths starting with ~ must be replaced with the full home directory path (~/ is supported and expanded; standalone ~ is not).

  • Binary data issues:
    The input binary field must exist and contain valid binary data. Missing or incorrectly named fields will cause errors.


Links and References

Discussion