dsh-syncthing-pair: Setting Up Bidirectional Syncthing Sync Between Two Macs Over SSH

Introduction

Local development environments frequently require cross-machine file synchronization. The common approach is to configure Syncthing’s Web UI to manually add remote devices, or to edit configuration files by hand. This requires both machines to be online simultaneously, involves tedious steps, and is error-prone. The DeepSeek Harness (DSH) plugin dsh-syncthing-pair connects to two Macs via SSH, automatically creates same-named Syncthing folders on both sides, and completes device configuration.

Plugin Scope

dsh-syncthing-pair is a DSH plugin maintained by ccccccccccccy. It solves the following problem: establishing bidirectional file synchronization between two Macs without manual configuration in the Syncthing UI — everything is done over SSH.

Core Features

  1. Connect to a remote Mac: Uses SSH with key-based authentication (BatchMode), no password prompt required. Python 3.8+ is required on the remote.
  2. Read local Syncthing configuration: Reads the API key from Syncthing’s config.xml, then connects to the local REST API at 127.0.0.1:8384. It does not edit configuration files directly.
  3. Create/update Syncthing folders: Creates or updates a same-named folder on both sides with type sendreceive, enables file watching, and adds each machine’s device ID to the other’s list.
  4. Deterministic folder ID: Computes a deterministic folder ID from the local and remote paths (format: st-<local-folder>-<hash>). Identical paths will update the same pair of folders.
  5. Status display: Shows the status of both sides in the Web panel and lists existing local Syncthing folders.
  6. Remote unreachable: Even when the remote is unreachable, local configuration still proceeds, and a copy-paste command is generated for execution in the remote terminal to complete configuration.
  7. Safety checks: Refuses to reuse a path already occupied by another folder, or an ID that points to a different path. It never deletes files.

Installation & Activation

Install from GitHub:

dsh plugin --profile web add github:cccccccccccccy/dsh-syncthing-pair

Install from a pre-built release package:

dsh plugin --profile web add https://github.com/cccccccccccccy/dsh-syncthing-pair/releases/download/v1.0.1/dsh-syncthing-pair-1.0.1.tgz

After installation, if the host application requires a restart, restart dsh web and then refresh the page. A Syncthing Sync entry will appear in the left sidebar.

Usage Steps

  1. Open Syncthing Sync in the left sidebar.
  2. Enter the remote SSH host: This can be an alias from ~/.ssh/config (e.g., remote-mac) or in user@host format.
  3. Enter the absolute folder paths on both the local Mac and the remote Mac.
  4. Optionally set a display name; the default is the local folder name.
  5. Click Start Sync.

If the remote is offline, the panel will generate a command. Copy it and run it in the remote terminal, or accept the folder in the remote Syncthing UI and set the path, then click Retry Remote.

The plugin also provides an agent tool that accepts the same input parameters:

{
  "sshHost": "remote-mac",
  "localPath": "/Users/me/Documents/Shared",
  "remotePath": "/Users/me/Documents/Shared",
  "label": "Shared"
}

How It Works

The DSH plugin uses a Python script (syncthing_pair.py) locally to connect to the Syncthing REST API, and executes the same Python script on the remote via SSH. The communication flow is as follows:

DSH plugin (this Mac)
  ├─ python3 syncthing_pair.py → local Syncthing REST API
  └─ ssh <host> python3 -     → remote Syncthing REST API

The plugin checks reachability on both sides before writing anything.

Security Mechanisms

  • Does not delete files and does not edit config.xml directly.
  • No telemetry data is collected.
  • Every route request is first validated through DSH’s connection service (ctx.connection.requestRejection), including Host/Origin protection and browser session authentication. Unauthenticated requests are rejected with 401/403 before reading the request body or operating on Syncthing.
  • SSH uses existing keys and host configurations; the plugin does not store credentials.
  • If a folder ID already exists but points to a different path, the plugin refuses rather than overwriting.

Limitations

  • SSH password prompts are not supported; key-based authentication or an SSH agent is required.
  • Syncthing GUI must be listening on 127.0.0.1:8384; custom GUI addresses are not supported yet.
  • Windows remote machines are not supported.
  • Folder IDs are derived from paths: moving a local folder and re-running will create a new pair, requiring the old folder to be deleted in Syncthing first.
  • Syncthing requires read/write access to the filesystem; on macOS, “Full Disk Access” permission may be needed when accessing protected locations.

Use Cases

Ideal for developers who need bidirectional file synchronization between two Macs, especially those using Syncthing as their sync solution. Before use, ensure:
- Both machines have Syncthing installed and running, with the REST API listening on 127.0.0.1:8384.
- Passwordless SSH access is available from the DSH host machine to the remote.
- Python 3.8+ is available on the remote machine.
- Syncthing instances can reach each other (via LAN, Tailscale, or relay).

Conclusion

dsh-syncthing-pair automates Syncthing folder configuration via SSH, reducing manual steps. It is well-suited for developers who need to quickly establish sync relationships across multiple Macs.

Plugin directory: https://www.skillhub.cn/plugins/cccccccccccccy/dsh-syncthing-pair
GitHub: https://github.com/cccccccccccccy/dsh-syncthing-pair

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye