# VS Code

Open a beam in VS Code, Cursor or Zed over SSH: your editor runs locally, while code, terminals and extensions run in the beam.



Open a beam in your editor over SSH. The editor window stays on your machine, while your code, terminals and extensions run in the beam. VS Code, Cursor and Zed are supported.

**Install the client tools and sign in**

Beams is a [Teleport](https://goteleport.com) project and uses [official Teleport client tools](https://goteleport.com/download/client-tools/).

The client tools include `tsh` to sign in and run commands, and `tctl` to administer your cluster if you have permission.



Cluster: `example.beams.run`. Edit this example to use your cluster name.

Install version **18.11.10** of the client:

**macOS**

Download and open the macOS installer, then follow its instructions.

```sh
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkg
```

**Linux**

For Linux x86-64, download and install the client tools:

```sh
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/install
```

**Windows**

For Windows x86-64, run these commands in PowerShell. Add the extraction directory (`$env:LOCALAPPDATA\Teleport`) to your user PATH to use `tsh` in future terminals; the last command adds it to this terminal's PATH.

```powershell
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"
```

Follow the official client [tools install guide](https://goteleport.com/download/client-tools/) for other versions and architectures.

Check that you’re running v18.11.10 of the client with `tsh version`.

```sh
tsh version
```

**Passwordless**

I sign in without a password (e.g. a passkey).

```sh
tsh login --proxy='example.beams.run' --auth=passwordless
```

**Password \& MFA**

I have a password & MFA set up for my account:

Replace `you@example.com` with your Teleport username.

```sh
tsh login --proxy='example.beams.run' --user=you@example.com
```

**SSO**

I sign in with SSO (e.g. Okta, GitHub, SAML).

```sh
tsh login --proxy='example.beams.run'
```

You also need:

- An OpenSSH client. Linux and macOS include one. On Windows, use the built-in [OpenSSH client](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse).
- One of these editors, with remote SSH support:
  - VS Code with the [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) extension.
  - Cursor, which includes its own Remote - SSH extension.
  - Zed, which has remote development built in.
- A running beam. Start one with `tsh beams add`.

**Warning: Files live in the beam**

A beam is deleted 11 hours after it starts, along with everything on its filesystem. Files you edit in your editor live in the beam, not on your machine. Commit and push your changes before the beam expires. Run `tsh beams ls` to see when each beam expires.

## How it works

Your editor connects to the beam with ordinary SSH through the Teleport proxy. `tsh config` writes an OpenSSH configuration that sends connections for your cluster through the proxy and signs in with your Teleport certificate, so your editor treats the beam as a regular SSH host.

Once connected, the editor installs a small server in the beam. That server reads and writes the beam's files, runs your terminals and hosts extensions such as language servers and debuggers. Only the editor window runs on your machine.

`tsh beams ide` wraps this flow: it finds the beam, builds its SSH address and opens your editor with the right remote arguments.

## 1. Set up your SSH configuration



Your editor needs the Teleport connection settings for your cluster in your OpenSSH configuration. Cluster: `example.beams.run`. Generate the settings with `tsh config`, and append them to your SSH configuration file:

**Linux and macOS**

**Local terminal**

```sh
mkdir -p ~/.ssh
tsh config --proxy='example.beams.run' >> ~/.ssh/config
```

**Windows**

Run these commands in **Command Prompt**, not PowerShell. PowerShell can re-encode the output, adding a byte order mark or changing the character encoding, and OpenSSH then can't read the file.

**Command Prompt**

```sh
tsh.exe config --proxy='example.beams.run' >> "%USERPROFILE%\.ssh\config"
```

If the command fails with `The system cannot find the path specified`, you haven't used SSH on this machine yet. Create the directory, then run the command again:

**Command Prompt**

```sh
mkdir "%USERPROFILE%\.ssh"
```

You only need to do this once per cluster. If you use more than one cluster, run it once for each.

Check that SSH sends beam connections through Teleport. Replace `CLUSTER_NAME` with `example.beams.run`. The output should include a `proxycommand` line that runs `tsh`:

**Local terminal**

```sh
ssh -G beams@any-beam.CLUSTER_NAME | grep -i proxycommand
```

## 2. Find your beam

List your beams:

**Local terminal**

```sh
tsh beams ls
```

The **ID** column shows each beam's alias, a short name such as `solar-fleet`. `tsh beams ide` accepts the alias. For the beam's UUID, which you need to connect without `tsh beams ide`, use the JSON output:

**Local terminal**

```sh
tsh beams ls --format json
```

## 3. Turn off the VS Code local server

If you use VS Code, turn off **Remote.SSH: Use Local Server** before you connect. Open **Settings**, search for `@ext:ms-vscode-remote.remote-ssh`, and clear **Use Local Server**. With this setting on, VS Code asks for a shell without a terminal on the first connection to a new host. Teleport doesn't support that, so the connection hangs.

Cursor and Zed don't have this setting.

## 4. Connect

**tsh beams ide (recommended)**

Open the beam in your editor, passing its alias or UUID:

**Local terminal**

```sh
tsh beams ide solar-fleet --ide=vscode
```

Supported `--ide` values are `vscode`, `cursor` and `zed`. Without `--ide`, `tsh` asks you to choose an editor, which needs an interactive terminal. A new window opens with a remote SSH session in the beam's home directory.

To use the same editor every time, set `TELEPORT_BEAMS_IDE`, for example in your shell profile. The `--ide` flag takes precedence:

**Local terminal**

```sh
export TELEPORT_BEAMS_IDE=vscode
```

On Windows, run `setx TELEPORT_BEAMS_IDE vscode`, then open a new terminal.

The command needs your editor's command-line launcher (`code`, `cursor` or `zed`) on your `PATH`. If it's missing, `tsh` tells you which one.

If VS Code doesn't have the Remote - SSH extension yet, it asks you to install it and reload the window, then continues connecting. On the first connection to a new host, VS Code may ask for the remote platform. Choose **Linux**.

**Manual**

Connect to the beam's SSH address, `beams@<beam-uuid>.example.beams.run`. The suffix must be your cluster name, because the SSH configuration from step 1 matches hosts under it.

In VS Code or Cursor:

1. Open the Command Palette (`Cmd/Ctrl` + `Shift` + `P`).
2. Run **Remote-SSH: Connect to Host**.
3. Enter `beams@<beam-uuid>.example.beams.run`.

Or connect from a terminal. Replace `BEAM_UUID` with your beam's UUID and `CLUSTER_NAME` with `example.beams.run`, then run the command for your editor:

**Local terminal**

```sh
code --new-window --remote ssh-remote+beams@BEAM_UUID.CLUSTER_NAME /home/beams
cursor --new-window --remote ssh-remote+beams@BEAM_UUID.CLUSTER_NAME /home/beams
zed ssh://beams@BEAM_UUID.CLUSTER_NAME/home/beams
```

## Verify

Your editor opens a new window connected to the beam. Open a terminal in that window, and check that you're the `beams` user in the beam:

**VS Code terminal**

```sh
whoami
echo "$BEAM_ALIAS"
```

## Troubleshooting

- **`Permission denied (publickey)`.** Your Teleport certificate has expired. The editor's log shows a line like `beams@35e2f694-….example.beams.run: Permission denied (publickey).` Sign in again with `tsh login --proxy=example.beams.run`, then reconnect.
- **The connection times out.** Your SSH configuration has no Teleport entry for this cluster, so SSH tries to reach the beam directly. Repeat step 1 for the beam's cluster, and check the `proxycommand` line again.
- **You're signed in to the wrong cluster.** Run `tsh status` to check the active cluster. If it isn't the beam's cluster, the connection fails with an authentication or access-denied error. Sign in to the right cluster with `tsh login`.
- **VS Code hangs while connecting.** Check that **Use Local Server** is off, as described in step 3, and reconnect.
- **`Bad configuration option` on Windows.** Your SSH configuration file has the wrong encoding, usually because PowerShell wrote it. Open `%USERPROFILE%\.ssh\config` in Notepad, choose **File** > **Save as**, set **Encoding** to **UTF-8**, and save over the file. This keeps your existing SSH settings.
- **The beam is gone.** Beams expire. Run `tsh beams ls` to check that the beam is still running.
