Use the Tailscale extension for Visual Studio Code
The Tailscale extension for Visual Studio Code lets you interact with resources in your tailnet from within the VS Code IDE.
You can interact with the machines in your tailnet from the primary sidebar in VS Code. Click the Tailscale icon, open the Tailscale Machine explorer, then select the machine that you want to view.
You can start a new terminal session or attach VS Code to a machine for remote development in one click. Hover over the machine you’d like to connect to, then click either the icon to start a terminal session, or the icon to attach the VS Code window to the machine.
If you are using the VS Code remote connection feature and your username on the remote instance is different from your local username, you’ll need to specify the remote username in your local SSH configuration. Otherwise, you may encounter connection issues.
Follow the steps below to configure your SSH settings:
- Find the remote instance by opening the Tailscale machine explorer. Right-click on the node you want to connect to, and select Copy DNS name.
- Edit your SSH configuration by opening your local SSH configuration file. This is typically located in
- Add the remote user configuration by inserting a new section into the configuration file for the remote server. Replace
my-server.example.ts.netwith the copied DNS name from the first step and
alicewith your remote username.
By configuring the SSH settings with the correct remote username, you should be able to successfully connect to the remote instance using VS Code.
To view and edit files on a machine in your tailnet, expand the machine, then click the File explorer item. You must have enabled Tailscale SSH on the machine in order to use the file explorer.
The first time you open the file explorer for a machine, you’ll be asked for an SSH username to use for that machine. This username will be locally cached to use for future connections to this machine. If you’d like to change the SSH username later, right-click on the machine and select Change SSH username from the context menu.
You can add new files or directories in the file explorer by right-clicking on a directory and selecting New file or New directory. To rename or delete an existing file or directory, right-click on the item and select Rename or Delete from the context menu.
By default, the File explorer will open the home folder (
~/) of the username you provided. You can change the root folder by right-clicking on the machine and selecting Change root directory from the context menu.
You can easily set up Tailscale Funnel inside of VS Code using the command palette or the Tailscale panel view. You must have Funnel enabled in your tailnet ACLs in order to take advantage of this feature.
The VS Code extension allows you to expose one port on your local machine to the public internet with Funnel. To expose multiple ports, use the Funnel CLI.
nodeAttrs) to your tailnet policy file.
- Open the panel. You can use the keyboard shortcut
- Enter the local port you want to expose over the internet in the port field.
- Click Start to begin serving this port over the internet.
You can open the public URL in your default browser or copy it to your clipboard. To edit the existing Funnel configuration in this panel, change the port number and click the Update button.
- Open the command palette with the keyboard shortcut
- Type Tailscale to view all of the extension’s commands.
- To start Tailscale Funnel, choose Tailscale: Share port publicly using Funnel.
- Enter the port number that you wish to share via Funnel.
When you start a local server from VS Code, Tailscale will ask if you’d like to share that port over the internet with Funnel.
If the Machine explorer isn’t working as expected, we recommend the following steps:
- Check that Tailscale SSH is enabled on the machines you want to connect to. For now, this functionality is only available on Linux devices and macOS devices running our open source tailscale + tailscaled CLI. This means that some features of the Machine explorer won’t work for Windows devices, iOS/Android devices, or macOS devices running the App Store or standalone Mac app.
- Check that your ACLs are set to allow Tailscale SSH access between your local machine and the machine you want to connect to.
- Ensure that you’re using a valid username that already exists on the machine. If you need to change the username to something else, right-click on the machine and select Change SSH username from the context menu.
If Funnel isn’t working as expected, we recommend the following steps:
- Check to ensure that Tailscale is signed in and active. On macOS and Windows, you can do this by clicking the Tailscale icon in your OS status bar. On Linux, run
tailscale statusin your CLI. If you have signed in to multiple Tailscale accounts on your device, ensure that the correct account is active.
- Ensure that your tailnet access controls (ACLs) are configured to allow Tailscale Funnel on your device.
- Ensure that MagicDNS and HTTPS Certificates are enabled on your tailnet.
tailscaleis available in the environment path. You can check this by running
tailscale statusin your CLI; if no command is found, you may need to add the Tailscale executable to your path. Alternatively, you can set its path via the
tailscale.pathsetting in VS Code.
tailscale.path: A path to the
tailscaleexecutable. If unset, the extension will use the environment path to resolve the
tailscaleexecutable. If set, the extension will use the supplied path. The path should include the executable name (for example,