{"id":30674322,"url":"https://github.com/lifailon/ssh-bot","last_synced_at":"2025-09-01T07:07:30.900Z","repository":{"id":302626754,"uuid":"1013031861","full_name":"Lifailon/ssh-bot","owner":"Lifailon","description":"Telegram bot for executing commands on remote hosts via ssh.","archived":false,"fork":false,"pushed_at":"2025-08-08T08:11:03.000Z","size":11105,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"rsa","last_synced_at":"2025-08-28T16:59:33.815Z","etag":null,"topics":["bot","chat-bot","go","ssh-client","telegrambot"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/lifailon/ssh-bot","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lifailon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-07-03T08:55:35.000Z","updated_at":"2025-08-20T21:55:33.000Z","dependencies_parsed_at":"2025-07-03T11:56:11.251Z","dependency_job_id":null,"html_url":"https://github.com/Lifailon/ssh-bot","commit_stats":null,"previous_names":["lifailon/ssh-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Lifailon/ssh-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fssh-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fssh-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fssh-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fssh-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lifailon","download_url":"https://codeload.github.com/Lifailon/ssh-bot/tar.gz/refs/heads/rsa","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fssh-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273086448,"owners_count":25043339,"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-09-01T02:00:09.058Z","response_time":120,"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":["bot","chat-bot","go","ssh-client","telegrambot"],"created_at":"2025-09-01T07:07:30.250Z","updated_at":"2025-09-01T07:07:30.890Z","avatar_url":"https://github.com/Lifailon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cimg src=\"img/logo.png\" width=\"220\" /\u003e\n    \u003cdiv\u003e\n    SSH Bot\n    \u003c/div\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\n    \u003cstrong\u003eEnglish (🇺🇸)\u003c/strong\u003e | \u003ca href=\"README_RU.md\"\u003eРусский (🇷🇺)\u003c/a\u003e\n\u003c/h4\u003e\n\nTelegram bot that allows you to run specified commands on a selected host in your home network and return the result of their execution. The bot does not establish a permanent connection with the remote host, which allows you to execute commands asynchronously.\n\nThe bot provides the ability to not waste time setting up a `VPN` server and money on an external IP address or `VPS` server to access the local network, and also eliminates the need to use third-party applications (`VPN` and `ssh` clients) on a remote device and does not require a stable Internet connection.\n\n![example](/img/demo.gif)\n\n## Roadmap\n\n- [X] Executing commands on the local (the one where the bot is running) or remote host (via `ssh`) in the specified interpreter.\n- [X] Support for parallel (asynchronous) command execution.\n- [X] `ssh` connection manager with host availability check.\n- [X] Support for directory navigation.\n- [X] Combined access to remote hosts by key and/or password.\n- [X] Error handling when using commands that require user input.\n- [X] Support for storing and reusing passed variables and functions (the `exit` command clears the history).\n\n## Launch\n\nYou can download the pre-compiled executable from the [releases](https://github.com/Lifailon/ssh-bot/releases) page and run the bot locally or in a Docker container using the image from [Docker Hub](https://hub.docker.com/r/lifailon/ssh-bot).\n\n\u003e [!NOTE]\n\u003e Before launching, you need to create your Telegram bot using [@BotFather](https://telegram.me/BotFather) and get its `API Token`, which must be specified in the configuration file.\n\n- Create a working directory:\n\n```shell\nmkdir ssh-bot\ncd ssh-bot\n```\n\n- Create and fill the `.env` file file inside the working directory:\n\n```shell\nTELEGRAM_BOT_TOKEN=XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nTELEGRAM_USER_ID=7777777777\n\n# Interpreter used only when running the bot local in Windows\n# Available values: powershell/pwsh\nWIN_SHELL=pwsh\n# Interpreter used on local and remote hosts in Linux\n# Available values: sh/bash/zsh or other\nLINUX_SHELL=bash\n\n# Parallel (async) execution of commands (default: false)\nPARALLEL_EXEC=true\n\n# Global parameters for ssh connection (low priority)\nSSH_PORT=2121\nSSH_USER=lifailon\n# Use password to connect (optional)\nSSH_PASSWORD=\n# Full path to private key (default: ~/.ssh/id_rsa)\nSSH_PRIVATE_KEY_PATH=\nSSH_CONNECT_TIMEOUT=2\n# Save and reuse passed variables and functions (default: false)\nSSH_SAVE_ENV=true\n# List of hosts separated by comma (high priority for username and port)\nSSH_HOST_LIST=root@192.168.3.102:22,root@192.168.3.103:22,192.168.3.105,192.168.3.106\n```\n\n\u003e [!NOTE]\n\u003e Access to the bot is limited by user ID. You can find out the Telegram `id` using [@getmyid_bot](https://t.me/getmyid_bot) or in the bot logs when sending a message to it.\n\n- Run the bot in a container:\n\n```shell\ndocker run -d --name ssh-bot \\\n    -v ./.env:/ssh-bot/.env \\\n    -v $HOME/.ssh/id_rsa:/root/.ssh/id_rsa \\\n    --restart unless-stopped \\\n    lifailon/ssh-bot:latest\n```\n\n\u003e [!NOTE]\n\u003e The bot environment is not stored in an image, but uses a mounting mechanism. To access remote hosts using a key, you need to forward the private key file from the host system to the container (as in the example above) and leave the contents of the `SSH_PRIVATE_KEY_PATH` variable empty.\n\n## Build\n\n```shell\ngit clone https://github.com/Lifailon/ssh-bot\ncd ssh-bot\ncp .env.example .env\ndocker-compose up -d --build\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Fssh-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifailon%2Fssh-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Fssh-bot/lists"}