{"id":13342886,"url":"https://github.com/grafana/xk6-ssh","last_synced_at":"2026-01-16T11:43:21.307Z","repository":{"id":44762613,"uuid":"349022246","full_name":"grafana/xk6-ssh","owner":"grafana","description":"Client extension for interacting with a host over SSH as part of your k6 test.","archived":false,"fork":false,"pushed_at":"2025-07-14T06:59:17.000Z","size":371,"stargazers_count":12,"open_issues_count":1,"forks_count":8,"subscribers_count":143,"default_branch":"main","last_synced_at":"2025-07-20T06:22:31.269Z","etag":null,"topics":["ssh","ssh-client","xk6"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-18T09:58:34.000Z","updated_at":"2025-07-14T06:59:13.000Z","dependencies_parsed_at":"2024-06-19T05:24:33.371Z","dependency_job_id":"dc198b12-2a80-41b1-a2b6-6ba21c02f11c","html_url":"https://github.com/grafana/xk6-ssh","commit_stats":{"total_commits":18,"total_committers":5,"mean_commits":3.6,"dds":0.5,"last_synced_commit":"ffab73fccccda306df0e5af67bc8bdde1056b15a"},"previous_names":["k6io/xk6-ssh"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/grafana/xk6-ssh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafana","download_url":"https://codeload.github.com/grafana/xk6-ssh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-ssh/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266520953,"owners_count":23942362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["ssh","ssh-client","xk6"],"created_at":"2024-07-29T19:30:06.602Z","updated_at":"2026-01-16T11:43:21.300Z","avatar_url":"https://github.com/grafana.png","language":"Go","funding_links":[],"categories":["Extensions"],"sub_categories":["Official"],"readme":"# xk6-ssh\nA k6 extension for using of SSH in testing. Built for [k6](https://github.com/grafana/k6) using [xk6](https://github.com/grafana/xk6).\n\n## Build\n\nTo build a `k6` binary with this extension, first ensure you have the prerequisites:\n\n- [Go toolchain](https://go101.org/article/go-toolchain.html)\n- Git\n\nThen:\n\n1. Download `xk6`:\n  ```bash\n  go install github.com/grafana/xk6/cmd/xk6@latest\n  ```\n\n2. Build the binary:\n  ```bash\n  xk6 build --with github.com/grafana/xk6-ssh@latest\n  ```\n\nThis will result in a `k6` binary in the current directory.\n\n## Example\n\n```javascript\nimport ssh from 'k6/x/ssh';\n\nexport default function () {\n  ssh.connect({\n    username: `${__ENV.K6_USERNAME}`,\n    password: `${__ENV.K6_PASSWORD}`,\n    host: [HOSTNAME],\n\tport: 22\n  })\n  console.log(ssh.run('pwd'))\n}\n```\n\nResult output:\n\n```plain\n$ ./k6 run script.js\n\n          /\\      |‾‾| /‾‾/   /‾‾/   \n     /\\  /  \\     |  |/  /   /  /    \n    /  \\/    \\    |     (   /   ‾‾\\  \n   /          \\   |  |\\  \\ |  (‾)  | \n  / __________ \\  |__| \\__\\ \\_____/ .io\n\n  execution: local\n     script: ../xk6-ssh/script.js\n     output: -\n\n  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):\n           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)\n\nINFO[0001] /home/userfolder                                 source=console\n\nrunning (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations\ndefault ✓ [======================================] 1 VUs  00m01.4s/10m0s  1/1 iters, 1 per VU\n\n     data_received........: 0 B 0 B/s\n     data_sent............: 0 B 0 B/s\n     iteration_duration...: avg=1.41s min=1.41s med=1.41s max=1.41s p(90)=1.41s p(95)=1.41s\n     iterations...........: 1   0.706079/s\n     vus..................: 1   min=1 max=1\n     vus_max..............: 1   min=1 max=1\n\n```\n\n## Testing Locally\nThis repo includes a [docker-compose.yml](docker-compose.yml) file that starts an [OpenSSH Server](https://docs.linuxserver.io/images/docker-openssh-server) from [LinuxServer.io](https://www.linuxserver.io/).\nThe `examples` directory contains scripts that are configured to work with this environment out of the box.\n\n\u003e :warning: Be sure that you've already compiled your custom `k6` binary as described in the [Build](#build) section!\n\nWe'll use this environment to run some examples.\n\n1. Start the docker compose environment.\n\n   ```shell\n   docker compose up -d\n   ```\n   Once you see the following, you should be ready.\n   ```shell\n   [+] Running 2/2\n    ⠿ Network xk6-ssh_default             Created\n    ⠿ Container xk6-ssh-openssh-server-1  Started\n   ```\n   Next, we'll use the `k6` binary we compiled in the [Build section](#build) above.\n\n1. Using our custom `k6` binary, we can execute our [example scripts](examples/).\n   ```shell\n   ./k6 run examples/connect-by-rsa-key.js\n   ``` \n   The RSA example will then connect to the local SSH server using the `example_rsa` private key.\n\n## FAQ\n\n### How to start `sudo` commands?\n\nBasically we don't provide sudo password autofill. We suggest to use `/etc/sudoers` for this purpose. Please checkout this [article](https://www.cyberciti.biz/faq/linux-unix-running-sudo-command-without-a-password/) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafana%2Fxk6-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-ssh/lists"}