SSH Nexus

Advanced SSH automation hub with intelligent connection management and network device support. Built with ❤️ by Sarryaz

Overview

The node provides SSH-based file operations on remote systems, including deleting files or directories via SSH. It supports two configuration modes for connecting to the SSH server: using stored credentials or dynamic parameters supplied at runtime. The 🗑️ Delete File operation allows users to remove a specified file or directory on a remote machine securely over SSH.

This node is beneficial in automation workflows where remote file management is required, such as cleaning up temporary files, removing logs, or managing deployment artifacts on servers without manual intervention.

Practical example:

  • Automatically delete old log files from a remote server after processing them.
  • Remove temporary files created during a deployment process on a remote host.

Properties

Name Meaning
Configuration Mode Choose how to configure the SSH connection:
- Use Credentials: Use stored SSH credentials (recommended for security).
- Dynamic Parameters: Use dynamic parameters from previous nodes or environment variables.
Dynamic Host Hostname or IP address of the SSH server (required if using Dynamic Parameters mode). Supports expressions and environment variables.
Dynamic Port SSH port number (default 22). Supports expressions and environment variables.
Dynamic Username Username for SSH login (required if using Dynamic Parameters mode). Supports expressions and environment variables.
Dynamic Password Password for SSH login (optional if using password authentication). Supports expressions and environment variables.
Dynamic Private Key Private key content for SSH authentication (optional alternative to password). Supports expressions and environment variables.
File/Directory Path Full path to the file or directory to delete on the remote system (required). Examples: /home/user/document.pdf or /var/log/.
Advanced Options Collection of optional advanced settings:
- Command Timeout (ms): Max time to wait for command completion (default 30000 ms).
- Output Parsing: How to parse command output (smart, json, table, raw, none).
- Continue on Error: Whether to continue processing other items if one fails.
- Cipher Override: Select specific SSH ciphers for this operation.
- Try Fallback Ciphers: Automatically try alternative ciphers if primary ones fail.
- Retry Delay (ms): Delay between connection retry attempts.
- Verbose Logging: Enable detailed debug logging.
- Line Ending Style: Choose line ending style for command execution (CRLF or LF).
- Device Type: Select network device type for optimized handling (mostly irrelevant for file delete).

Output

The node outputs a JSON object per input item with the following structure:

  • success: Boolean indicating whether the delete operation succeeded (true if exit code is 0).
  • deletedPath: The full path of the deleted file or directory.
  • stderr: Standard error output from the SSH command, if any.
  • exitCode: Exit code of the delete command (0 means success).
  • parseOutput: The selected output parsing mode used.

Example output JSON:

{
  "success": true,
  "deletedPath": "/var/log/old.log",
  "stderr": "",
  "exitCode": 0,
  "parseOutput": "smart"
}

No binary data is produced by this operation.

Dependencies

  • Requires an SSH server accessible from the n8n instance.
  • Needs either stored SSH credentials configured in n8n or dynamic SSH connection parameters provided at runtime.
  • Uses the node-ssh library internally for SSH connections.
  • Optional advanced options allow customizing SSH cipher suites and connection retries.
  • No external API keys are needed beyond SSH authentication credentials.

Troubleshooting

  • Invalid path errors: The node validates the file path and disallows unsafe paths containing .., ~ alone, or sensitive system directories like /etc or /var/log for uploads. For delete, ensure the path is correct and accessible.
  • SSH connection failures: Check that the SSH host, port, username, and authentication method are correct. Enable verbose logging in advanced options to get detailed connection logs.
  • Permission denied: The SSH user must have permission to delete the specified file or directory on the remote system.
  • Command timeout: If the delete command takes longer than the configured timeout, increase the "Command Timeout" value in advanced options.
  • Continue on Error: If enabled, the node will process all items even if some deletions fail; otherwise, it stops on first error.
  • Invalid host format: When using dynamic parameters, the host must only contain letters, numbers, dots, and hyphens.
  • Port range validation: Dynamic port must be between 1 and 65535.

Links and References

Discussion