Files
coder/docs/workspaces/workspace-access/index.md
T
Atif Ali ae6b1faea3 fix: make SSH connection hints consistent across CLI, dashboard and docs (#31188)
SSH hints across the CLI, dashboard and docs used different, sometimes
broken, workspace names. This makes them consistent with minimal,
non-breaking changes and no new syntax:

- Plain `ssh` hostnames: `<agent>.<workspace>.<owner>.<suffix>` (or
`<workspace>.<suffix>` for single-agent workspaces). Works with
`config-ssh` (with or without `--no-wildcard`) and Coder Connect.
- `coder` CLI arguments: `[<owner>/]<workspace>[.<agent>]`, with the
owner unless the workspace was given by its bare name.

Built on #31192, which is now merged into `main`.

## Changes

- **`coder ping` multi-agent error**: now suggests `coder ping
<workspace>.<agent>` instead of listing agents without a runnable
command. Owner-qualified and UUID inputs retain `<owner>/<workspace>`.
JSON-mode errors leave stdout empty, and ping still does not autostart
stopped workspaces.
- **`coder ssh` multi-agent error**: when run directly (no
`--ssh-host-prefix`/`--hostname-suffix`), it suggested `ssh
coder.dogfood.matifali`, which never resolves without a matching SSH
config entry or Coder Connect. For an agent named `dev`, it now suggests
`coder ssh dogfood.dev`, or `coder ssh bob/dogfood.dev` if the workspace
was given as `owner/name` or by ID. Here `.dev` selects the agent; it is
not an SSH hostname suffix. The ProxyCommand path used by `config-ssh`
and the IDE plugins still suggests the full hostname.
- **`coder show` / `coder create`**: the access column dropped the
owner, so `coder show bob/dogfood` or `coder show <id>` suggested `coder
ssh dogfood.dev`. It now keeps the owner unless the workspace was given
by its bare name.
- **`coder config-ssh`**: the example `ssh <workspace>.coder` is
ambiguous for multi-agent workspaces. It now names an agent, `ssh
<agent>.<workspace>.<owner>.coder`, reading a stopped workspace’s known
agents from its latest successful start using the same template version.
With `--no-wildcard`, the hint reuses the workspace snapshot and
resources used to write the Host entries.
- **Dashboard "Connect via SSH"**: rendered `...<owner>.undefined` when
the deployment has no hostname suffix. It now falls back to `coder ssh
<owner>/<workspace>` for single-agent workspaces, or `coder ssh
<owner>/<workspace>.<agent>` otherwise. With a hostname suffix, owned
single-agent workspaces show `ssh <workspace>.<suffix>` unless that
hostname collides with the deployment’s legacy prefix block. Prefix
collisions, shared workspaces and multi-agent workspaces retain the full
agent/workspace/owner hostname. The count includes agents across all
resources and devcontainers. Commands remain undefined while the SSH
config loads, with a spinner instead of a premature fallback. If the
initial load fails, it displays the error while keeping the CLI command
available.
- **Docs**: workspace access docs said `config-ssh` prints `ssh
coder.<workspace>`; it prints `ssh <workspace>.coder`. Added the
multi-agent hostname, noted it in the Desktop docs, and updated the
Gateway host and the networking page to `<workspace>.coder`.

## Before / after

```console
$ coder ssh dogfood
error: multiple agents found, please specify the agent name, available agents: [coder dev]
Try running:
         $ ssh dev.dogfood.matifali       # before: does not resolve
         $ coder ssh dogfood.dev          # after: dev is the agent name
```

## Compatibility

Hostname parsing (`findWorkspaceAndAgentByHostname`,
`normalizeWorkspaceInput`) is unchanged, so every hostname that resolves
today still does. The VS Code, JetBrains Gateway and Toolbox plugins
write their own `Host` entries and run `coder ssh --stdio
--ssh-host-prefix <prefix>`, so they don't reach the changed hints.
`TestSSH_AgentHostnames` connects with their
`<prefix>--<owner>--<workspace>.<agent>` form, and with the
`<agent>.<workspace>.<owner>` forms used by `config-ssh` and the
dashboard.

## Verification

CLI/resource race tests pass, including the complete original `TestSSH`
suite and the new agent-hostname round trips. `TestConfigSSH_Example`
checks running two-agent and stopped one-/two-agent workspaces whose
import defaults differ, with and without `--no-wildcard`. It verifies
the hint has a matching generated Host entry and reuses workspace
history once per stopped workspace. `TestShow` covers bare names,
owner-qualified names and UUIDs; `TestCreate/CreateForOtherUser` checks
the owner-qualified preview. Mutation checks confirmed the new
assertions fail when the protected behavior is removed.

`TestPing_AgentSuggestions` covers bare names, owner-qualified names,
UUIDs and JSON-mode errors with a shared fixture. The tests fail without
the new hints; an owner-omission control also fails the qualified/UUID
cases. The original network-heavy `TestPing` suite remains unchanged and
passes its normal race run.

Normal and strict new-code Go lint, frontend checks/lint/typechecking,
all eleven SSHButton stories, and docs checks pass. Browser checks
verified copied SSH/CLI commands and keyboard dismissal; screenshots
were visually inspected. The single-agent follow-up adds 25 command-copy
cases covering ownership, agents across resources, subagents, and
zero/unknown counts. All 53 affected SSHButton, AgentRow, and
AgentDevcontainerCard stories pass, with browser validation of both real
callers and regression/mutation controls for the command-selection
guards.

<details>
<summary>CI follow-up and validation commands</summary>

After #31192 merged, the parent commits were dropped and the remaining
eleven commits were rebased onto the merge commit `fb6d287528`.
Range-diff and full-tree comparisons confirm no implementation changes.
Revalidated the complete SSH/ping/config race suite and strict lint
after that rebase.

Latest rebase preserves the implementation and carries the docs edits to
main’s renamed `docs/workspaces/` paths. The SSHButton documentation
links and preview URL use the new routes. Revalidated the full
SSH/ping/config CLI race suite, strict lint, 25 frontend tests, 53
stories, and docs/manifest/redirect checks. The local shell’s Oh My Zsh
update prompt interrupted the first race run; the unchanged suite passed
with `DISABLE_AUTO_UPDATE=true` scoped to the test process.

Latest review follow-up: connection commands remain undefined during
initial loading, and each instruction is gated on its own command. A
cached SSH suffix remains usable after a failed refetch; a story
captures that state. Rebased directly onto `main` at `fb6d287528` after
#31192 merged. The P2 follow-up preserves native hostnames that collide
with legacy prefix blocks, uses workspace-specific history for stopped
agents, and retains safe precreated devcontainer names.

Earlier stress runs of the unmodified `TestSSH` suite exceeded the 6,144
MiB guard under 35-repeat stress. Its existing scenarios remain
unchanged. The three added agent-qualified hostname cases have
independent full SSH round-trip coverage in `TestSSH_AgentHostnames`,
with a shared fixture. The current top-PR changed-test selector chooses
seven tests without the unrelated `TestSSH` scenarios, and the complete
selected set passes 35 repetitions at parallelism 16 with the same
memory guard. No test cases, repetitions, parallelism or memory checks
were removed.

```sh
go test -race -tags=testsmallbatch ./cli ./cli/cliui -run '^TestSSH$|^TestSSH_AgentHostnames$|TestPing|TestConfigSSH|TestShow|TestCreate|Test_agentSSHSuggestion|Test_suggestWithOwner|TestWorkspaceResources|Test_noWildcardHostNames|Test_previousStartResources|TestCommandHelp' -count=1 -parallel=4
GOMEMLIMIT=6GiB golangci-lint run --allow-serial-runners --concurrency=4 --new-from-rev=origin/main ./cli/...
GOMEMLIMIT=6GiB make lint/go/new-code GO_LINT_CONCURRENCY=4
CODER_TEST_MEMORY_LIMIT_MIB=6144 TS_DEBUG_DISCO=true TS_DEBUG_DERP=true go test -tags=testsmallbatch -p=4 -count=35 -parallel=16 -shuffle=1 -timeout=10m -run '^(TestConfigSSH_Example|TestCreate|TestPing_AgentSuggestions|TestSSH_AgentHostnames|TestShow|Test_agentSSHSuggestion|Test_suggestWithOwner)(/.*)?$' ./cli
cd site
pnpm check
pnpm lint
pnpm test src/modules/resources/SSHButton/SSHButton.test.tsx
pnpm test:storybook src/modules/resources/SSHButton/SSHButton.stories.tsx src/modules/resources/AgentRow.stories.tsx src/modules/resources/AgentDevcontainerCard.stories.tsx --run
```

</details>

Follow-up to #19943. Tracks
[CLI-67](https://linear.app/codercom/issue/CLI-67/fix-coder-ssh-suggestions-for-multi-agent-workspaces).

Preview:
https://coder.com/docs/@fix%2Fssh-multi-agent-hint/workspaces/workspace-access

> 🤖 This PR was created with the help of Coder Agents, and has been
reviewed by my human. 🧑💻
2026-11-05 10:19:38 +05:00

9.5 KiB

title
title
Access your workspace

There are many ways to connect to your workspace, the options are only limited by the template configuration.

Deployment operators can learn more about different types of workspace connections and performance in our networking docs.

You can see the primary methods of connecting to your workspace in the workspace dashboard.

Workspace View

Web Terminal

The Web Terminal is a browser-based terminal that provides instant access to your workspace's shell environment. It uses xterm.js and WebSocket technology for a responsive terminal experience with features like persistent sessions, Unicode support, and clickable URLs.

Terminal Access

Read the complete Web Terminal documentation for customization options, keyboard shortcuts, and troubleshooting guides.

Install the CLI

Download the coder CLI for your platform from the Coder downloads page.

On macOS and Linux, you can also install the CLI from your Coder deployment. The install script downloads the CLI from your deployment, so it works in air-gapped deployments and installs the same version as your control plane.

  1. In the dashboard, open your user menu.

  2. Select Install CLI.

  3. Copy the command on the page.

    Install Coder binary from your deployment

  4. Run the command in your terminal.

SSH

Through the CLI

Coder will use the optimal path for an SSH connection (determined by your deployment's networking configuration) when using the CLI:

coder ssh my-workspace

Or, you can configure plain SSH on your client below.

Note

The coder ssh command does not have full parity with the standard SSH command. For users who need the full functionality of SSH, use the configuration method below.

Run remote commands with quoting

Arguments after -- are joined with spaces into a single command string before being sent to the workspace agent (per Request for Comments (RFC) 4254 §6.5, which defines the SSH exec request as a single string). Your local shell consumes outer quotes before the CLI ever sees the arguments, so inner quoting is not preserved on the wire.

This means a common pattern from interactive shells does not behave as you might expect:

# Surprising: prints an empty line, NOT "ready"
coder ssh my-workspace -- bash -c 'echo ready'

The local shell strips the single-quotes, the CLI receives the argv [bash, -c, echo, ready], and the remote agent runs bash -c echo ready. echo gets no arguments and ready is bound to $0. The same caveat applies to plain ssh user@host -- bash -c '...'. This is SSH protocol semantics, not a coder ssh limitation.

For commands that need preserved quoting, use one of these patterns:

Heredoc via stdin (recommended for multi-line scripts):

coder ssh my-workspace -- bash <<'EOF'
echo ready
EOF

A single-argument script payload:

coder ssh my-workspace -- /path/to/script.sh

Exit-code-only probe (when you only need to know if the command succeeded):

coder ssh my-workspace -- true && echo "agent is reachable"

Configure SSH

Coder generates SSH key pairs for each user to simplify the setup process.

  1. Use your terminal to authenticate the CLI with Coder web UI and your workspaces:

    coder login <accessURL>
    
  2. Access Coder via SSH:

    coder config-ssh
    
  3. Run coder config-ssh --dry-run if you'd like to see the changes that will be before you proceed:

    coder config-ssh --dry-run
    
  4. Confirm that you want to continue by typing yes and pressing enter. If successful, you'll see the following message:

    You should now be able to ssh into your workspace.
    For example, try running:
    
    $ ssh <workspace_name>.coder
    

Your workspace is now accessible via ssh <workspace_name>.coder (for example, ssh myEnv.coder if your workspace is named myEnv). If your workspace has more than one agent, include the agent and owner: ssh <agent>.<workspace_name>.<owner>.coder. The Connect via SSH button on the workspace page shows the exact command for each agent.

coder is the default hostname suffix. Your administrator can change it with CODER_WORKSPACE_HOSTNAME_SUFFIX.

Tip

If you use a third-party SSH client that discovers hosts by parsing ~/.ssh/config (such as the VS Code Remote-SSH sidebar or scripts that enumerate known hosts), run coder config-ssh --no-wildcard instead. This generates an individual Host entry for each workspace and its known agents rather than a single wildcard block, making your workspaces visible to those tools.

For a stopped workspace, Coder uses agent names from its most recent successful start. If that start is unavailable or used a different version from the workspace's current template version, Coder generates only the workspace entry.

To populate missing agent entries:

  1. Start the workspace successfully.
  2. Run coder config-ssh --no-wildcard again to add the agent entries.

Visual Studio Code

You can develop in your Coder workspace remotely with VS Code. We support connecting with the desktop client and VS Code in the browser with code-server.

Demo

Read more details on using VS Code in your workspace.

Cursor

Cursor is an IDE built on VS Code with enhanced AI capabilities. Cursor connects using the Coder extension.

Read more about using Cursor with your workspace.

Devin Desktop

Devin Desktop (formerly Windsurf, formerly Codeium) is Cognition's AI-powered code editor designed for AI-assisted development. Devin Desktop connects using the Coder extension.

Antigravity

Antigravity is Google's desktop IDE. Antigravity connects using the Coder extension.

Read more about using Antigravity with your workspace.

Claude Desktop

Claude Desktop is Anthropic's desktop app for Claude. Once the Coder CLI is installed and logged in, your running workspaces appear in Claude Desktop.

Read more about using Claude Desktop with your workspace.

JetBrains IDEs

We support JetBrains IDEs using Gateway. The following IDEs are supported for remote development:

  • IntelliJ IDEA
  • CLion
  • GoLand
  • PyCharm
  • Rider
  • RubyMine
  • WebStorm

Read our docs on JetBrains for more information on connecting your JetBrains IDEs.

code-server

code-server is our supported method of running VS Code in the web browser. Learn more about what makes code-server different from VS Code web or visit the documentation for code-server.

code-server in a workspace

Other Web IDEs

We support a variety of other browser IDEs and tools to interact with your workspace. Each of these can be configured by your template admin using our Web IDE guides.

Supported IDEs:

  • VS Code Web
  • JupyterLab
  • RStudio
  • Airflow
  • File Browser

Our Module Registry also hosts a variety of tools for extending the capability of your workspace. If you have a request for a new IDE or tool, file an issue in our Modules repo.

Coder Desktop

Coder Desktop is a native application that provides seamless access to your workspaces via a virtual private network (VPN) tunnel. With Coder Desktop, you get:

  • Automatic port forwarding: All workspace ports are available at workspace-name.coder:PORT with no manual setup
  • SSH access: Connect with ssh workspace-name.coder using any SSH client, or ssh agent-name.workspace-name.owner.coder for workspaces with more than one agent.
  • File sync: Bidirectional file synchronization between local and remote directories

Coder Desktop is the recommended way to access workspace services for developers who want a seamless, native experience.

Ports and Port forwarding

You can manage listening ports on your workspace page through the listening ports window in the dashboard. These ports are often used to run internal services or preview environments.

Tip

For automatic access to all ports without manual configuration, use Coder Desktop.

You can also share ports with other users, or port-forward through the CLI with coder port-forward. Read more in the docs on workspace ports.

Open Ports window

Remote Desktops

Coder also supports connecting with a Remote Desktop Protocol (RDP) solution, see our RDP guide for details.