ssheep / run a command on many machines
You have a handful of boxes โ VPSes, a homelab, some Raspberry Pis behind a router โ and you want to run one command on all of them. It turns out every easy way to do that costs something.
ssh in a loop |
A key on every machine (or a password each time), and a way to reach each one โ a VPN, a port forward, or a public address. It runs one machine at a time unless you background it, and it stops at the first box that is down. |
pdsh / clustershell |
Parallel and built for this, but the same reachability and key problem, plus a config file listing hosts. Home on an HPC cluster, more than on three VPSes. |
| Ansible | No agent, but still SSH keys on every host and reachability to every host, a
control node with Python and Ansible installed, and YAML. Superb at describing a
machine's state; heavy if all you want is to run uptime now. |
| A mesh VPN (Tailscale, WireGuard) | Solves reachability, and that is a lot. You still distribute SSH keys, install an agent everywhere, and then still need a loop or Ansible to run the command. |
| ssheep | No inbound port, no key on any machine, no control node to install. Each machine makes its own key and dials out to a relay; you run one command here and it fans out. It is not a configuration-management system โ see the limits below. |
On the machine you want to drive from โ your laptop is fine โ one command creates the flock and prints a single line:
$ ssheep master flock "myflock" ๐ you are a master of flock "myflock" ๐ run this on every machine you want to be a sheep curl -fsSL https://ssheep.xyz/install.sh | sh -s -- --enroll "<line>"
Paste that line into each machine. It installs one static binary, the machine makes its own key, and asks to be let in. Then, from the first machine:
$ ssheep run "myflock" -- uptime pi| 14:22:01 up 3 days, 2:14, load average: 0.08 nas| 14:22:01 up 12 days, 4:02, load average: 0.31 vps-1| 14:22:01 up 41 days, 6:51, load average: 0.10
ssheep copy puts a file on all of them, ssheep shell "myflock"
--name nas opens a real terminal on one, and ssheep upgrade "myflock"
pushes a new build everywhere. The output streams as it arrives, ^C reaches
the far side and stops the command, and --json gives you data for a script.
Every machine makes its own key when it joins; the master never sends one, and none of them listen on a port. Machines that can be reached relay for the ones that cannot, so nobody picks a server and there is no middleman holding your data โ the relay forwards ciphertext it cannot read. More in how it works.
It is honest about its limits, because they decide whether it is the right tool:
One line, one static binary, on Linux, macOS or Windows. Also in the package
repositories, if you prefer: apt install ssheep ยท dnf install
ssheep ยท pacman -S ssheep-bin ยท brew install
bash3r777/ssheep/ssheep.