# Remote & headless sessions

Host work on a Mac or Linux machine and connect through the SSH setup you already trust.

Canonical page: https://thebestterminal.com/docs/remote-sessions

Harness 2.3.2 · Documentation reviewed 2026-10-13

## What runs where

The remote host runs HarnessDaemon and the CLI. Your Mac runs the graphical app, and your local CLI can target the remote daemon with --host. Transport is an SSH tunnel forwarding the daemon’s control socket—not a public, unauthenticated TCP service.

The graphical app and Metal renderer are macOS-only. Linux support covers the daemon and CLI. Keep the two ends on compatible Harness versions.

## Prepare the remote host

Install a Swift 6.0-or-newer toolchain appropriate to the host, check out the public repository, and build the daemon and CLI:

**On the remote host**

```shell
git clone https://github.com/robzilla1738/harness-terminal.git harness
cd harness
swift build -c release
./.build/release/HarnessDaemon
```

The last command runs the daemon in that terminal. For long-lived hosting, arrange supervision with the host’s service manager; merely closing that shell is not a durable service setup. Make harness-cli available to non-interactive SSH commands on the host. In a second host terminal, harness-cli socket-path prints the actual socket path.

> **Check non-interactive PATH**
>
> A command that works in an interactive SSH shell may not be on PATH for ssh host command. Use an absolute path to the remote harness-cli when necessary.

## Add the host

In the Mac app, open the sessions popover and choose Add Remote Host. Supply the SSH destination; Harness detects the socket and tests the connection. For CLI setup, replace me@devbox with your actual SSH destination:

**On your local machine**

```shell
harness-cli remote add --name devbox --ssh me@devbox \
  --socket "$(ssh me@devbox harness-cli socket-path)"
harness-cli remote list
harness-cli ping --host devbox
```

The remote account needs access to its own daemon socket. First confirm that a normal SSH connection to the destination succeeds.

## Use your SSH options

Pass an option and its value as separate --ssh-arg arguments. For example, using port 2222 requires that port both for socket discovery and for the registered connection:

**Terminal**

```shell
harness-cli remote add --name devbox --ssh me@devbox \
  --socket "$(ssh -p 2222 me@devbox harness-cli socket-path)" \
  --ssh-arg -p --ssh-arg 2222
```

Supported options include -p for port, -i for identity file, and -J for a jump host. Prefer an SSH config host alias when it already captures your connection settings. Do not add untrusted forwarding or authentication options blindly.

## Work against the remote daemon

**Terminal**

```shell
harness-cli ls --host devbox
harness-cli new-session --host devbox --cwd /home/me/Code
harness-cli capture-pane --host devbox --surface "logs"
```

Use a real absolute path on the remote host for --cwd. An unquoted ~ can expand in your local shell before Harness sends the command. Use a target returned by the remote ls command instead of assuming a local pane ID exists remotely.

Each remote host opens in its own app window alongside local work. SSH tunnels reconnect after a drop; reconnecting a client does not itself restart the remote daemon.

## Remove a saved host

**Terminal**

```shell
harness-cli remote remove --name devbox
```

Removing a connection entry is different from deliberately terminating remote workloads. Manage those workloads on their host, and capture any diagnostics you need before killing sessions or restarting a daemon.

## Reconnect and diagnose a host

When SSH drops, Harness preserves the last screen with a connection notice and retries attaching to surviving work. Use Remote → host → Retry Connection or Connection Details. Diagnostics exclude credentials and terminal output.

A process must still exist on the host to be reattached. Sleep pauses local processes; it does not guarantee uninterrupted execution. New workspace actions on an older daemon can report that an update is required.

> **Do not replay uncertain mutations**
>
> A request might have reached the host before the connection failed. Inspect the workspace before repeating setup creation, command input, or other mutations. Reconnection does not rerun setup startup commands.

## Source references

- [README.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/README.md)

- [docs/COMMANDS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/COMMANDS.md)

- [docs/WORKSPACE-WORKFLOWS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/WORKSPACE-WORKFLOWS.md)

## Related guides

- https://thebestterminal.com/docs/cli

- https://thebestterminal.com/docs/sessions-and-panes

- https://thebestterminal.com/docs/troubleshooting

