npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-ssh-command-dynamic-host

v1.0.9

Published

An n8n custom node for running SSH commands on dynamic hosts.

Readme

n8n-nodes-ssh-command-dynamic-host

A custom n8n node that enables SSH command execution on dynamic hosts, which can be provided as part of input data. This is particularly useful when working with lists of remote servers and automating tasks such as monitoring, maintenance, or orchestration.

✨ Features

  • Connect to SSH servers using dynamic hostnames from input data (item.json)
  • Execute any command remotely
  • Full support for multiple items (parallel/batch execution)
  • Handles SSH fingerprint verification (non-interactively)
  • Compatible with n8n’s native “Continue on error” feature

📦 Installation

Manual (for self-hosted n8n)

  1. Clone or download this repository to your n8n custom nodes folder.

  2. Inside your n8n user folder (~/.n8n/ or /home/user/.n8n/):

mkdir -p ~/.n8n/nodes
cd ~/.n8n/nodes
git clone https://github.com/your-org/n8n-nodes-ssh-command-dynamic-host.git
cd n8n-nodes-ssh-command-dynamic-host
npm install
npm run build

    Add this to your environment (if not already enabled):

N8N_CUSTOM_EXTENSIONS=/home/user/.n8n/nodes

    Restart your n8n server:

pm2 restart n8n
# or
docker restart n8n

⚙️ Node Configuration
Field	Description
Host Field	The name of the JSON key in each item that contains the target hostname, OR a literal hostname string.
Username	SSH username to connect with.
Password / Key	Password (or SSH private key) used for authentication.
Port	SSH port (default is 22).
Command	The command to run on the remote host. Can use expressions like {{ $json.something }}.
🧠 How It Works

    If Host Field value is a string like host, and each item has { "host": "my.server.com" }, the node will extract it dynamically.

    If it’s a full hostname (e.g. my.server.com), that static hostname will be used for all items.

    The node loops through each input item and connects to the respective server over SSH, running the same command on each.

🔐 SSH Known Hosts Behavior

This node automatically accepts and caches unknown SSH fingerprints (like typing "yes" when manually connecting for the first time).

⚠️ Use caution in production environments! This disables SSH strict host key checking for automation convenience.
✅ Example Use Case

Input:

[
  {
    "host": "server1.example.com"
  },
  {
    "host": "server2.example.com"
  }
]

Set Host Field to host, and your command to something like:

uptime

Output:

[
  {
    "host": "server1.example.com",
    "output": "15:23:45 up 10 days,  2:34,  1 user,  load average: 0.00, 0.01, 0.05"
  },
  {
    "host": "server2.example.com",
    "output": "15:23:45 up 2 days,  4:12,  3 users,  load average: 0.30, 0.25, 0.40"
  }
]

🛠 Development
Build

npm install
npm run build

File Structure

    nodes/SSHCommandDynamicHost.node.ts – Main node definition and logic.

    package.json – Node package setup and metadata.

    dist/ – Compiled output folder after running npm run build.

🧪 Testing

    Use test SSH servers or local VMs.

    Toggle the "Continue On Error" setting in the n8n UI to ensure workflows continue even if one SSH connection fails.

    Use SplitInBatches and Wait nodes to rate-limit requests if needed.

📄 License

MIT © 2025 Robertas Z (aka @MadCatMining)