Lightweight SSH orchestration for quick audits and ad-hoc automation. Think of it as “nmap for SSH” with a focus on readable output and fast iteration.
- Human-friendly automation: run commands, scripts, or file syncs without committing to full-blown configuration management.
- Batteries included: works with macOS/Linux shells and standard OpenSSH; optional
sshpassfor password-based hosts. - Fast iteration: simple inventories, terse command flags, and parallel execution with live progress feedback.
nix/nixos
nix shell github:kr-nn/sshernix profile install github:kr-nn/ssher{
inputs.ssher = "github:kr-nn/ssher/master";
outputs = { self, ssher, ... }:
let
ssherPkgs = import ssher { inherit system; }
in
{
... ssherPkgs.ssher ...
}
}Clone the repo and invoke the script directly:
git clone https://github.com/kr-nn/ssher
cd ssher
./ssherEnsure the script is executable (chmod +x ssher) if your checkout loses permissions.
- Inventory: text file listing hosts (one per line). Lines beginning with
#are ignored. - Mode: first positional argument; defines what action to run against each host.
- Parallel jobs: default to CPU count, adjustable via
-J. The TUI shows queued/success/failed while jobs execute.
./ssher <mode> -i <inventory> [options]| Mode | Description |
|---|---|
ping |
Probe hosts and report authentication method (key vs password). |
run |
Execute a shell command on each host. |
script |
Pipe a local script to every host (bash -s). |
upload |
Append/overwrite a remote file with local contents. |
collect |
Pull remote file contents into a local report file. |
update |
Push data produced by collect back to the respective hosts. |
-i, --inventory <file>: host list (required).-u, --user <name>: override SSH username (defaults to current user).-l, --localfile <path>: local file for modes that read from disk (script,upload,collect,update).-r, --remotefile <path>: remote file target (upload,collect,update).-c, --command <cmd>: command forrun.-p, --password: prompt once and usesshpassfor password authentication.-o, --options: custom SSH options (e.g., jump hosts, custom ciphers). Overrides defaults; re-add safety flags if needed.-J <jobs>: parallelism degree; defaults tonproc.
Run a health check:
./ssher run -i _inv/prod.txt -u root -c 'uptime && df -h /'Audit SSH auth methods:
./ssher ping -i _inv/lan.txt | tee _reports/lan_ping.logHarden your environment
./ssher script -i _inv/edge.txt -u ops -l scripts/hardening.sh -J 8Collect configuration files:
./ssher collect -i _inv/prod.txt -u root -r /etc/ssh/sshd_config -l _reports/sshd_config.collectPush updates generated by collect:
./ssher update -i _inv/prod.txt -u root -r /etc/ssh/sshd_config -l _reports/sshd_config.collect -a oUpload an authorized key (with prompt to overwrite/append):
./ssher upload -i _inv/new_hosts.txt -l ~/.ssh/id_ed25519.pub -r ~/.ssh/authorized_keys- Combine with
nmapto build inventories quickly:
nmap -n -Pn -p 22 192.168.1.0/24 -oG - | awk '/open/{print $2}' > _inv/lan.txt - Use
_-prefixed directories (e.g.,_inv,_reports) to keep local data out of version control if you mirror the original workflow. - Review the built-in help for detailed descriptions:
./ssher.