Package Information
Available Nodes
Documentation
n8n-nodes-kingssh
This is an n8n community node package that provides KingSSH functionality for n8n workflows. It allows you to execute commands and transfer files via KingSSH using either username/password or KingSSH key authentication.
Features
Authentication Methods:
- Username and Password
- KingSSH Key (with optional passphrase)
Operations:
- Execute KingSSH commands
- Download files via SFTP
- Upload files via SFTP
AI Agent Integration:
- Works as a Tool with n8n's AI agents
- Allows AI to execute terminal commands on remote servers
Installation
Follow these steps to install this node package in your n8n instance:
Local Installation (Recommended for Development)
Clone this repository:
git clone https://github.com/j.king/n8n-nodes-kingssh.gitNavigate to the package directory:
cd n8n-nodes-kingsshInstall dependencies:
npm installBuild the package:
npm run buildLink the package to your n8n installation:
npm linkIn your n8n installation directory, run:
npm link n8n-nodes-kingssh
Global Installation (For Production)
You can install this package directly from npm:
npm install -g n8n-nodes-kingssh
Usage
After installation, you'll find the KingSSH node in the n8n nodes panel under the "Transform" category.
Setting up KingSSH Credentials
- Go to the n8n credentials manager
- Click on "Create New Credentials"
- Select "KingSSH Credentials"
- Choose your authentication method:
- Username & Password: Enter your KingSSH server host, port, username, and password
- KingSSH Key: Enter your KingSSH server host, port, username, private key, and optional passphrase
Executing KingSSH Commands
- Add the KingSSH node to your workflow
- Select "Command" as the resource
- Select "Execute" as the operation
- Enter the command you want to execute
- Select your KingSSH credentials
The node will return the command output (stdout and stderr).
Transferring Files
Downloading Files
- Add the KingSSH node to your workflow
- Select "File" as the resource
- Select "Download" as the operation
- Enter the remote file path
- Enter the local file path
- Specify the binary property name
- Select your KingSSH credentials
The node will download the file and store it in the specified binary property.
Uploading Files
- Add the KingSSH node to your workflow
- Select "File" as the resource
- Select "Upload" as the operation
- Enter the remote file path
- Enter the local file path
- Specify the binary property name containing the file data
- Select your KingSSH credentials
The node will upload the file to the specified remote path.
Example Workflows
Execute a Command and Process the Output
This workflow executes a command on a remote server and processes the output:
KingSSH Node:
- Resource: Command
- Operation: Execute
- Command:
ls -la /var/log
Function Node:
- Code:
return items.map(item => { const lines = item.json.stdout.split('\n'); return { json: { files: lines.filter(line => line.trim() !== '') } }; });
- Code:
Download a Log File and Parse It
This workflow downloads a log file from a remote server and parses it:
KingSSH Node:
- Resource: File
- Operation: Download
- Remote File Path:
/var/log/syslog - Binary Property Name:
data
Function Node:
- Code:
const binaryData = items[0].binary.data; const content = Buffer.from(binaryData.data, 'base64').toString('utf-8'); const lines = content.split('\n'); return { json: { logLines: lines.filter(line => line.includes('ERROR')) } };
- Code:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
- J. King