Many developers run long DeepSeek Harness (DSH) tasks on cloud VMs, WSL instances, or headless Linux workstations under a desk. Because dsh web binds strictly to 127.0.0.1 for safety, exposing it manually usually means maintaining Nginx or Caddy reverse proxies, TLS certificates, WebSocket headers, and browser workarounds. With the built-in CLI bundled inside dsh-zen-remote, a headless server joins your encrypted mesh in a single command so both your laptop desktop app and mobile PWA can take over sessions directly.

Three common pitfalls of manual headless DSH setups

Exposing a headless dsh web process by hand tends to hit three recurring friction points:

  • Loopback-only binding: Listening on 127.0.0.1 protects local files and terminals, while opening raw ports directly to the public Internet lacks per-device authentication and session boundaries.
  • Reverse proxy and HTTPS overhead: Browser Web Push notifications require a trusted HTTPS origin, meaning Caddy or Nginx rules, certificate renewal, and /api/remote.mux WebSocket Upgrade forwarding all need manual upkeep.
  • Host directory-picker traps: Certain automatic directory-picker configurations try to open an OS dialog on the server machine itself in headless environments, forcing users to hunt down patch.yml overrides.

When running dsh-zen-remote in Peer mode (--role peer), your headless server only dials outbound to your selected gateway, opening zero inbound web ports and eliminating manual reverse-proxy templates. If you choose standalone Host mode (--role host, without joining a gateway), configure the Host's own ingress instead: use lan strictly for same-LAN or VPN access, or configure a reachable HTTPS ingress (an existing reverse proxy or Caddy) or an outbound tunnel (such as Cloudflare Tunnel) when phones need cross-network cellular access.

Join a headless server in 4 steps

1. Add the plugin to the web profile and restart

Install and register dsh-zen-remote inside your server's web profile, then restart your running dsh web service:

dsh plugin --profile web add dsh-zen-remote

2. Run the interactive CLI wizard over SSH

The package ships the dsh-zen-remote CLI binary so SSH sessions complete the exact same onboarding flow without a local GUI window:

npx dsh-zen-remote setup --role peer

The interactive wizard prompts for your language before starting (supporting arrow keys, Space, and Enter in TTYs):

  1. Choose gateway: Connect through the hosted gateway or enter the URL of your self-hosted open-source gateway-server.
  2. Authorize via device code: Over SSH, the wizard prints a device code and terminal QR code so you can sign in on your laptop or phone browser instead of opening a browser on the server.
  3. Probe edges & join: Measures latency against available relay nodes and connects automatically to the fastest reachable edge.

If this server will not join a gateway and only serves standalone mobile PWA or desktop Client connections, run npx dsh-zen-remote setup --role host instead: rather than the gateway flow above, the wizard enters Host ingress selection and reachability verification (lan for same-LAN/VPN only, an existing HTTPS proxy / caddy / external ingress, or an outbound cloudflared tunnel when there is no public IP—picking lan alone will not be reachable from a phone on cellular data). Keep --role peer (default) when joining the server into a bidirectional multi-computer mesh alongside laptops and desktops.

3. Scripted device-code login and --no-wait

For automated provisioning scripts or repeatable SSH logins, skip the interactive prompts with direct subcommands:

dsh-zen-remote peer join --oauth-device

Useful operational flags:

  • --network <id>: Join a specific virtual network directly without interactive selection.
  • --relay <id|auto>: Pin an edge relay or let latency probing pick automatically.
  • --no-wait: Submit the join request and exit immediately (JSON output separates submitted and ready flags). Pressing Ctrl-C while waiting returns exit code 130 without revoking the submitted request.

4. Inspect paths, trust rotated keys, or leave cleanly

Manage the live connection anytime from the server shell:

  • Inspect this node's nodeId, admission state, and active path (direct vs encrypted relay) to every peer:
dsh-zen-remote peer status
  • Explicitly trust a peer after an intentional reinstall or key rotation triggers TOFU protection:
dsh-zen-remote peer trust <nodeId>
  • Disconnect cleanly from the mesh:
dsh-zen-remote peer leave

Operate the server from both laptops and phones

Once your headless server shows online in Peer mode:

  1. Desktop sidebar mounting: Install dsh-zen-remote on your laptop and join the same network. Any server session with its Remote Access toggle switched on appears automatically in your laptop sidebar with synced file previews, terminal access, and dsh-better-sidebar panels.
  2. Mobile-friendly DSH remote control: Scan the quick-login QR code to open the touch-first PWA on your phone and add it to your home screen—check progress, review diffs, continue chats, and receive timely Web Push alerts when a task needs confirmation or finishes.

Hosted gateway vs self-hosted gateway-server

If you already maintain an always-on VPS, deploy the open-source gateway-server image (kyomio/zen-remote-gateway) with a single Docker command so all workstations and headless servers route through your own domain; otherwise, the hosted gateway removes TLS and domain maintenance completely. In either mode, Peer session payloads (messages, code diffs, and terminal output) remain end-to-end encrypted on your devices and the gateway holds no decryption private keys: Peer relay data frames read only a 28-byte routing header for forwarding, Peer join handshakes process network ID, node ID, and public device keys, and the hosted mobile PWA path uses a separate framing format with connection routing metadata while TLS terminates with the Host's locally generated private key (keeping session contents unreadable to the gateway). See the Self-Hosted Gateway guide and CLI & Configuration Reference for full options.

Frequently asked questions

Do I need to open inbound port 3088 or 3080 in cloud security groups?

No for --role peer; conditional for standalone --role host. When running --role peer against the hosted gateway or a self-hosted gateway-server, your DSH server only makes outbound connections and needs zero inbound security-group ports opened for dsh web or 3088 (only the separate gateway-server host itself needs public HTTPS ingress when self-hosted). For standalone --role host without a gateway, choosing lan alone only works inside the same LAN or VPN—cellular phone access requires either an outbound tunnel such as cloudflared or a reachable HTTPS reverse-proxy ingress.

Will the headless server reconnect automatically after a reboot?

Yes, provided dsh web runs under a process supervisor such as systemd or Docker. Once dsh web starts at boot and loads dsh-zen-remote, it resumes using saved credentials.

When should I pick --role peer vs --role host on a server?

Pick --role peer when sharing sessions across multiple computers on an encrypted mesh or when you want cross-network mobile PWA access without exposing inbound ports; pick standalone --role host when a single server does not use a gateway and relies on its own LAN/VPN, HTTPS ingress, or cloudflared tunnel as described in Without Hosted Gateway.