{"id":51233533,"url":"https://github.com/zxysilent/sshx","last_synced_at":"2026-06-28T18:30:35.064Z","repository":{"id":360184213,"uuid":"1249017204","full_name":"zxysilent/sshx","owner":"zxysilent","description":"Lightweight SSH tool for single/multi-host remote command execution and SCP file transfer","archived":false,"fork":false,"pushed_at":"2026-06-18T09:06:21.000Z","size":99,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-18T11:09:53.582Z","etag":null,"topics":["devops","golang","multi-host","remote-execution","scp","ssh-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zxysilent.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-25T09:10:20.000Z","updated_at":"2026-06-18T09:06:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zxysilent/sshx","commit_stats":null,"previous_names":["zxysilent/sshrun","zxysilent/sshx"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/zxysilent/sshx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxysilent%2Fsshx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxysilent%2Fsshx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxysilent%2Fsshx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxysilent%2Fsshx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zxysilent","download_url":"https://codeload.github.com/zxysilent/sshx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxysilent%2Fsshx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34900367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","golang","multi-host","remote-execution","scp","ssh-client"],"created_at":"2026-06-28T18:30:32.526Z","updated_at":"2026-06-28T18:30:35.058Z","avatar_url":"https://github.com/zxysilent.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sshx — Lightweight SSH Remote Execution Tool\n\n## Installation\n\n### `go install` (with build timestamp)\n\n```bash\ngo install -ldflags \"-s -w -X 'main.buildTime=$(date +'%Y-%m-%d %H:%M:%S')'\" github.com/zxysilent/sshx@latest\n```\n\n### Build from source (with git sha + timestamp)\n\n```bash\ngo build -ldflags \"-s -w -X 'main.buildSha=$(git rev-parse --short=8 HEAD)' -X 'main.buildTime=$(date +'%Y-%m-%d %H:%M:%S')'\" -o sshx .\n```\n\n## Quick Start\n\nBehaves like native `ssh`, with built-in multi-host support:\n\n```bash\n# Interactive shell (like ssh)\nsshx 192.168.1.10\n\n# Single host command\nsshx 192.168.1.10 \"ls -la /\"\n\n# Multi-host (repeatable -H)\nsshx -H host1 -H host2 -H host3 \"df -h\"\n\n# Concurrent with -c\nsshx -H h1 -H h2 -H h3 -H h4 -c 4 \"uptime\"\n\n# File transfer\nsshx scp -p 2222 ./local.txt root:pass@192.168.1.10:/tmp/remote.txt\nsshx scp -J bastion 192.168.1.10:/etc/hostname ./hostname.txt\n```\n\n## Subcommands\n\n| Subcommand | Purpose | Multi-`-H` |\n|------------|---------|:----------:|\n| *(default)* | Interactive shell or command execution | ✅ |\n| `scp` | Upload/download one file via SCP | ❌ |\n\n\u003e `exec` is kept as an alias for the default mode.\n\n## `-H` Format\n\n```\n-H [user[:password]@]host[:port]\n```\n\nPer-host credentials override global `-u`/`-P`/`-p`. Omitted fields fall back to globals.\n\n```bash\n-H 192.168.1.10                     # bare host\n-H root@192.168.1.10                # custom user\n-H root:pass@192.168.1.10           # user + password\n-H root:pass@192.168.1.10:2222      # all fields\n```\n\n## Global Flags\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `-H` | — | Target host for multi-host mode (repeatable) |\n| `-p` | `22` | SSH port |\n| `-u` | current user | SSH username |\n| `-P` | `$SSHX_PASSWD` | SSH password (supports `$VAR` expansion) |\n| `-i` | `~/.ssh/id_rsa` | Private key path |\n| `-t` | `10s` | Connection timeout |\n| `-J` | — | Jump/bastion host (repeatable for chaining) |\n| `-c` | `1` | Max concurrency (1=sequential, 128=max) |\n| `-f` | — | Local shell script to run on remote hosts |\n| `-h` | — | Show help |\n\n`-c` / `-f` only take effect in multi-host mode (`-H`).\n\n## Usage Patterns\n\n### Single-host mode (like ssh)\n\n```bash\n# Interactive shell\nsshx 192.168.1.10\nsshx root@192.168.1.10\n\n# Single command\nsshx 192.168.1.10 \"df -h\"\nsshx -u admin -P secret 192.168.1.10 \"hostname\"\n\n# Via jump host\nsshx -J bastion 192.168.1.20 \"uptime\"\n```\n\n### Multi-host mode (`-H`)\n\n```bash\n# Sequential (default -c 1)\nsshx -H host1 -H host2 -H host3 \"df -h\"\n\n# Concurrent\nsshx -H h1 -H h2 -H h3 -H h4 -c 4 \"uptime\"\n\n# Per-host credentials\nsshx -H root:pass1@host1 -H root:pass2@host2 \"whoami\"\n\n# Local script on multiple hosts\nsshx -f deploy.sh -H host1 -H host2 -H host3\n\n# Script + concurrency\nsshx -f script.sh -H h1 -H h2 -c 4\n```\n\n### File Transfer (`scp`)\n\n```bash\n# Upload\nsshx scp -p 2222 ./config.yaml root:pass@192.168.1.10:/etc/app/config.yaml\n\n# Download\nsshx scp 192.168.1.10:/var/log/app.log ./app.log\n\n# Via jump host\nsshx scp -J 192.168.1.10 ./config.yaml 192.168.1.20:/tmp/config.yaml\n```\n\nRemote paths use `[user[:password]@]host:/path`. Specify the port with `-p`.\n\n## Jump Host (`-J`)\n\nTunnel through one or more bastion hosts in order:\n\n```bash\n# Single jump\nsshx -J root:pass@192.168.1.10 -H 192.168.1.20 \"hostname\"\n\n# Multi-hop chain\nsshx -J hop1 -J hop2 -H target \"uptime\"\n\n# File transfer via jump\nsshx scp -J 192.168.1.10 ./local.txt 192.168.1.20:/tmp/remote.txt\n```\n\n## Authentication Strategy\n\n1. **Private key first**: `-i` path or `~/.ssh/id_rsa` if readable\n2. **Password fallback**: `-P` flag → `$SSHX_PASSWD` env var → inline `-H user:pass@host`\n3. **Error**: exits if neither is available\n\nAvoid passwords in shell history:\n\n```bash\nexport SSHX_PASSWD=\"your-secret\"\nsshx -H 192.168.1.10 \"uptime\"\n```\n\n## Flag Interleaving\n\nFlags and positional arguments can be freely interleaved:\n\n```bash\n# All equivalent\nsshx -H host1 -H host2 \"ls -la\"\nsshx \"ls -la\" -H host1 -H host2\nsshx -c 4 ls -la -H host1 -H host2 /tmp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxysilent%2Fsshx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxysilent%2Fsshx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxysilent%2Fsshx/lists"}