{"id":50304567,"url":"https://github.com/gray0128/syncthing-sh","last_synced_at":"2026-05-28T15:01:33.439Z","repository":{"id":356558858,"uuid":"1232051624","full_name":"gray0128/syncthing-sh","owner":"gray0128","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-08T16:11:49.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-08T17:27:55.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/gray0128.png","metadata":{"files":{"readme":"README.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-07T14:40:44.000Z","updated_at":"2026-05-08T16:11:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gray0128/syncthing-sh","commit_stats":null,"previous_names":["gray0128/syncthing-sh"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gray0128/syncthing-sh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gray0128%2Fsyncthing-sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gray0128%2Fsyncthing-sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gray0128%2Fsyncthing-sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gray0128%2Fsyncthing-sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gray0128","download_url":"https://codeload.github.com/gray0128/syncthing-sh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gray0128%2Fsyncthing-sh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33613431,"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-05-28T02:00:06.440Z","response_time":99,"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":[],"created_at":"2026-05-28T15:01:32.271Z","updated_at":"2026-05-28T15:01:33.432Z","avatar_url":"https://github.com/gray0128.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# syncthing-sh\n\nUbuntu 20.04+ 一键部署 Syncthing 服务端脚本（`amd64` / `arm64`）。\n\n默认部署：\n- `strelaysrv`（私有中继，默认不加入公共池）\n- `stdiscosrv`（私有发现服务）\n\n可选部署：\n- `syncthing` 核心服务（含 Web GUI，默认 **不部署**）\n\n脚本特性：\n- 交互式输入，尽量提供默认值\n- 从 GitHub Release 拉取官方二进制\n- 非 root 运行服务\n- systemd 沙箱加固\n- 自动升级关闭（`--no-upgrade` + `STNOUPGRADE=1`）\n- 自动配置防火墙端口（检测到 `ufw` 时）\n- 支持卸载（默认保留数据，可选完整删除）\n\n## 快速开始\n\n### 在线安装（推荐）\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/gray0128/syncthing-sh/main/install.sh | sudo bash -s -- install\n```\n\n\u003e 注意：URL 不要加反引号 `` `...` ``。\n\n### 在线卸载\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/gray0128/syncthing-sh/main/install.sh | sudo bash -s -- uninstall\n```\n\n### 在线查看客户端配置（完整监听地址 + 全局发现）\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/gray0128/syncthing-sh/main/install.sh | sudo bash -s -- show-client-config\n```\n\n### 下载后执行（最稳妥）\n\n```bash\ncurl -fsSLo install.sh https://raw.githubusercontent.com/gray0128/syncthing-sh/main/install.sh\nsudo bash install.sh install\n```\n\n## 交互项说明\n\n- 服务运行用户：要求是现有用户\n- 中继端口：默认 `22067`\n- 中继状态端口：默认 `22070`\n- 发现服务端口：默认 `8443`\n- Syncthing GUI 监听：默认 `0.0.0.0:8384`（仅在启用核心服务时生效）\n- 中继 Token：默认自动生成并启用；输入 `none` 可禁用\n- 是否部署 syncthing 核心服务：默认 `N`\n- 防火墙来源 CIDR：默认 `any`\n- 客户端访问域名（或IP）：用于生成客户端配置串\n- 全局发现是否保留 `default`：用于生成客户端配置串\n\n## 强校验\n\n`install` 结束后会强校验：\n- relay/discovery 服务必须处于运行状态\n- 实际生效 `ExecStart` 必须匹配交互输入的端口和 token\n- relay/discovery 端口必须已监听\n\n校验失败会直接报错退出，避免“看似成功但配置未生效”。\n同时会打印当前监听端口和最近服务日志，便于快速定位问题。\n\n## 防火墙端口\n\n脚本会尝试放行：\n- `22000/tcp`\n- `22000/udp`\n- `21027/udp`\n- 中继端口（默认 `22067/tcp`）\n- 中继状态端口（默认 `22070/tcp`）\n- 发现服务端口（默认 `8443/tcp`）\n- GUI 端口（仅启用核心服务且地址可解析端口时）\n\n\u003e 如果机器未安装 `ufw`，脚本会跳过防火墙配置并给出提示。\n\n## 安全建议\n\n- 生产环境请将防火墙来源从 `any` 改为可信网段\n- 中继建议启用 `Token`，避免被任意客户端滥用\n- 如启用 GUI，务必使用强密码并建议结合反向代理与 HTTPS\n- 定期备份 `/var/lib/syncthing-server` 及相关配置目录\n\n## 卸载策略\n\n- 默认：仅移除服务和二进制，保留数据\n- 可选：完整删除（包括脚本记录的服务端数据与状态目录）\n\n## 免责声明\n\n该脚本面向 Ubuntu 20.04+，并以官方发布资源为基础实现。请先在测试环境验证，再用于生产环境。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgray0128%2Fsyncthing-sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgray0128%2Fsyncthing-sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgray0128%2Fsyncthing-sh/lists"}