KingSSH

Execute commands via KingSSH

Actions3

Overview

This node, named "KingSSH," allows users to execute commands on a remote system via SSH. It is particularly useful for automating tasks that require command-line access to remote servers, such as running scripts, managing files, or retrieving system information.

A common scenario would be remotely executing shell commands like ls -la to list directory contents or running custom scripts for deployment or maintenance. This node can be integrated into workflows where remote server management is needed without manual SSH login.

Properties

Name Meaning
Command The command string to execute on the remote system. Example: ls -la

Output

The node outputs JSON data with the following structure:

  • command: The exact command string that was executed.
  • stdout: The standard output returned by the command execution.
  • stderr: The standard error output returned by the command execution (if any).

Example output JSON:

{
  "command": "ls -la",
  "stdout": "total 12\ndrwxr-xr-x  3 user user 4096 Apr 27 10:00 .\ndrwxr-xr-x 14 user user 4096 Apr 26 09:00 ..\n-rw-r--r--  1 user user   18 Apr 27 10:00 file.txt\n",
  "stderr": ""
}

No binary data is produced for this operation.

Dependencies

  • Requires an SSH connection to a remote host.
  • Needs credentials including host, port, username, and either password or private key authentication.
  • The node depends on the ssh2 library for establishing SSH connections and executing commands.
  • Users must configure appropriate SSH credentials in n8n before using this node.

Troubleshooting

  • Connection errors: If the node throws a "KingSSH connection error," verify that the SSH credentials are correct, the remote host is reachable, and the SSH service is running.
  • Command execution failures: Errors like "Failed to execute command" indicate issues with the command syntax or permissions on the remote system. Check the command validity and user permissions.
  • Unsupported operations: The node only supports the "execute" operation for the "command" resource. Using other operations will result in an error.
  • Timeouts or hangs: Network latency or firewall restrictions might cause delays or failures. Ensure network connectivity and firewall rules allow SSH traffic.

Links and References

Discussion