Skip to content

ManualRemote

Connect from Chan Desktop

Add a devserver with its connect script, use the control terminal, recover from dropped connections, and open remote windows.

What you can do

  • Add a devserver with the script that reaches it: ssh, Eternal Terminal, Lima, WSL, or none.
  • Connect with one key. Chan Desktop reads the devserver's token, so you never copy it.
  • Open the devserver's terminals and workspaces as native windows.
  • Disconnect, sleep, or quit, and find everything still running when you connect again.
  • Script it all with chan devserver.

Add a devserver

Install chan on the other machine first: see Run a devserver.

  1. Open the form

    Open the Computers screen with Cmd+P on macOS or Ctrl+Shift+P on Windows and Linux, turn to the last card, and click Add devserver.

  2. Fill it in

    FieldEnter
    Name (optional)The card's title, also the name chan devserver commands accept.
    AddressWhere Chan Desktop dials: localhost:9901, 127.0.0.1:8787, or a full URL with its token, http://host:8787/?t=TOKEN.
    Connect script (optional)A command that brings the devserver up and holds the tunnel open. It runs in a control terminal. See Recipes.
    Auto-hide control terminal on successTick it to hide the control terminal once connected.
  3. Add and connect

    Click Add devserver. The new card comes to the front, selected: click the connection control in its header, or press o.

The Add devserver card, turned over to its form. This is a live mock: fill it in, add, and connect.

Recipes

Copy the Address and Connect script for your route. Replace user@host with your ssh destination.

RouteAddressConnect script
sshlocalhost:9901ssh -L localhost:9901:127.0.0.1:8787 user@host '~/.local/bin/chan devserver join --port 8787'
Eternal Terminallocalhost:9901et --tunnel 9901:8787 --command '~/.local/bin/chan devserver join --port 8787' user@host
Lima, from macOSlocalhost:8787limactl shell default ~/.local/bin/chan devserver join
WSL, from Windowslocalhost:8787wsl ~/.local/bin/chan devserver join
Direct: LAN, a VM or container porthttp://host:8787/?t=TOKENNone
  • 9901 is the tunnel's local end and must match the Address; 8787 is the devserver's port. For a second devserver, pick another free local port and use it in both.
  • Eternal Terminal must be installed on both machines: see its setup guide.
  • For a direct address, bind the devserver where the local machine reaches it, or publish its port, and copy the URL from chan devserver status there.

The control terminal

Connecting opens a window titled Control Terminal - NAME that runs the connect script through your login shell. Answer ssh's prompts there. join prints a CHAN_DEVSERVER_TOKEN= line; Chan Desktop reads the token from it and dials the Address.

The control terminal is the connection: it stays open while the script runs, as the first row on the devserver's card.

You doThe connection
Tick Auto-hide control terminal on successStays up; the control terminal hides once connected. Show it again from its row.
Close the connected control terminal, then choose HideStays up.
Close the connected control terminal, then choose CloseEnds with the script, and the devserver's windows here close. Everything keeps running on the devserver.

Disconnect and reconnect

WhenYou seeDo
You press Disconnect, o on the cardThe devserver's windows close here. Terminals, programs, workspaces and layouts keep running there.Connect again: every shown window reopens where it was.
The tunnel drops while the script still runsThe windows show reconnecting to the chan server and keep trying, with Show in Computers (see connection health). Once the drop has lasted 8 s, the cover adds Restart connection and Abandon.Wait, press Show in Computers to see the devserver's card, Restart connection to run the script again, which closes and reopens the devserver's windows, or Abandon to disconnect.
The script exits with an error, as ssh does when the network goesThe windows close. The control terminal stays, with the script's last words and process exited (255); press Ctrl+D to close this tab, and its row flashes.Read why, close the control terminal, and connect again.

An ssh tunnel dies when the laptop sleeps or the Wi-Fi changes; Eternal Terminal reconnects across both. Chan Desktop does not connect devservers by itself at start.

Open remote terminals and workspaces

On the devserver's cardKeyOpens
New terminal, in the headertA terminal window on the devserver.
New window, on a workspace rowwA window of that workspace.
New terminal window, on a workspace rowtA window of that workspace that starts with a terminal.
The power button, on a workspace rowoTurns the workspace on or off.

The command launcher's Computers scope does the same from any window on the devserver. To add a workspace, run chan open PATH in a devserver terminal, or this here:

$chan serve /srv/notes --on lab

Remote windows survive a disconnect and a restart of Chan Desktop: connect again and carry on. On a Linux devserver run by systemd, its terminals also survive a restart or an upgrade of the devserver: see Restart without losing terminals. To copy, move files and forward ports across the connection, see Tunnels, transfers and clipboard.

From a terminal

These need Chan Desktop running. NAME is the name or URL chan devserver ls shows.

CommandWhat it does
chan devserver register URL --name NAME --script CMDAdds a devserver, as the form does, without connecting.
chan devserver lsLists the devservers with their state. --json for scripts.
chan devserver connect NAMEConnects, as o does. Prompts appear on the Computers screen.
chan devserver disconnect NAMEDisconnects. The devserver keeps running.
chan devserver forget NAMERemoves it and its stored token. A connected one is refused unless you add --force.
chan serve PATH --on NAMEServes a directory of the devserver as a workspace.
chan close PATH --on NAMEStops serving it. It stays registered there.
chan workspace forget PATH --on NAMEUnregisters it on the devserver. Its files stay.
Details and limits
  • Keep connect scripts in the foreground, as the form's tip says (ssh -N). A script that exits cleanly right after connecting, such as one that starts a background tunnel, leaves the connection up; one that exits cleanly later disconnects.
  • A token in the Address is stored and wins over the one the script prints, so a script can be only the tunnel, such as ssh -N -L ..., to a devserver already running as a service. After rotate-token, edit the devserver and paste the new URL.
  • The stored token is never shown again. An edit with a bare host:port keeps it, and a URL with an empty ?t= clears it.
  • With no script and no token, Chan Desktop reads the token and port of the devserver that shares its own chan home on the local machine.
  • Click a devserver's name on its card to edit it. A connected devserver's settings are read-only: disconnect first.
  • While a dead control terminal is open, Connect stays off and says to close it first.
  • A devserver whose window feed stays silent is marked unreachable on its card; disconnect and connect again.
  • The control terminal's title uses the Name, or host:port when there is none.
  • A devserver's first start opens one terminal window, titled with the remote host's name.
  • In the Lima recipe, default is the name of the Lima instance.
  • Eternal Terminal signs in over ssh, then reconnects on its own port, normally 2022.
  • Chan Desktop and the devserver must speak the same management protocol; on a mismatch, update whichever is older.
  • Devservers that come from a gateway are listed by chan devserver ls and marked, but only the Gateways screen manages them.

Next