Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

VS Code: Microsoft Remote Development extensions

15 min read
Improve this page

The Remote Development extensions turn Visual Studio Code into a complete remote development tool. With them, you can work directly on a server over SSH, in a Docker container, inside WSL or through secure tunnels, while keeping the local features of VS Code: IntelliSense, debugging, extension management.

The goal? Avoid compatibility problems between environments, simplify administration and speed up collaborative work. With a single click, you open a remote project as if it were stored on your workstation.

What you will learn

  • Understand the Remote extensions (SSH, Dev Containers, WSL).
  • Connect to a remote server with Remote-SSH.
  • Run code, terminal and extensions on the remote side.
  • Configure access through the SSH configuration file (~/.ssh/config).
  • Forward a port to view a remote service in your browser.
  • Secure the connection (SSH keys, passphrase).

Prerequisites: Visual Studio Code installed on your workstation, a Linux server reachable over SSH with a key (see Creating and managing SSH keys), and a local OpenSSH client (the ssh command must answer in a terminal).

What are the VS Code Remote extensions?

The Remote Development Extension Pack groups several essential tools to turn Visual Studio Code into a complete remote development environment. In a single package, you get everything you need to work on a server, in a container, or even in a Linux distribution from Windows, without leaving the editor.

This pack includes the following extensions:

Remote-SSH

With Remote-SSH, you can connect to a remote server and open a folder as if you were there. All your usual VS Code tools remain available: IntelliSense, debugging, extension management and file browsing. This extension is particularly useful for system administration or for development on remote environments (cloud, VMs, bare-metal servers).

The principle fits in one sentence: only the interface stays on your workstation, everything else runs on the server. On the diagram, look at the red arrow: it is the only link between the two machines, and it is an SSH connection. On the remote side, a small VS Code server handles the files, the terminal, the extensions and the debugger.

Two groups: your workstation, which holds the VS Code interface, and the remote server. An SSH connection links the interface to the VS Code server installed on the server; the server gives access to the project files, the terminal, the extensions and the debugger, which all run on the server.Remote serverYour computerSSH connectionVS Code interfacewindow and editorVS Code Serverinstalled on first connectionFilesTerminalExtensionsDebugger
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

Remote-WSL

The Remote-WSL extension (Windows Subsystem for Linux) lets Windows users switch instantly into an integrated Linux environment. You can thus develop, build and run your projects in a Linux context, while keeping the comfort of your Windows workstation. It is the ideal tool for hybrid Windows/Linux workflows.

Remote-Containers

With Remote-Containers (the extension is now called Dev Containers), you open a project directly in a Docker container. The benefit? Every developer on the team works in the same isolated environment, with the same dependencies. This guarantees reproducibility and avoids the infamous "it works on my machine". A detailed guide is available here: using DevContainers (in French).

Remote-Tunnels

Less well known, but just as powerful, Remote-Tunnels lets you reach a remote machine without any SSH configuration. You just start a secure tunnel with the command:

Terminal window
code tunnel

You can then open that machine remotely from any other VS Code instance. It is a practical solution for support, temporary access to a client machine, or for a machine behind a strict firewall.

By bringing together Remote-SSH, Remote-WSL, Remote-Containers and Remote-Tunnels, the Remote Development pack turns VS Code into a universal development platform, able to adapt to almost every environment.

What features do the VS Code Remote extensions offer?

The Remote Development Extension Pack of Visual Studio Code (in French) groups several extensions, Remote SSH, Remote WSL, Remote Containers and Remote Tunnels, that make remote work easier. They offer a unified development environment, wherever the code runs. Here is an overview of the main features available with these tools.

Secure remote connection

The Remote extensions let you connect to different remote environments (server over SSH, Docker container, WSL distribution or secure tunnel) directly from VS Code. You can edit, debug and run code in these environments as if you were local, without leaving the editor.

Remote file explorer

Once the connection is established, you access the whole remote file system from the VS Code explorer. You can open, edit, create and delete files on the target, with navigation identical to that of your local machine. This simplifies work on complex projects spread across several environments.

Remote command execution

Thanks to the integrated terminal, you can run shell commands directly in the remote environment (server, container, WSL). Whether it is to install dependencies, manage services or run scripts, everything happens in the unified VS Code interface, with no external terminal.

IntelliSense and extension support

Advanced features such as IntelliSense (auto-completion, documentation, contextual suggestions) remain available even in a remote environment. You can also install extensions specific to each target (for example a Python extension enabled only in a container), which improves flexibility and avoids conflicts between projects.

Remote debugging

The Remote extensions allow debugging in the target environment. You can set breakpoints, follow execution, analyze variables and diagnose problems specific to a given system (Linux, Windows, Docker container). This ensures your application works correctly in environments close to production.

Managing multiple environments

You can configure several profiles or contexts (several SSH servers, different WSL distributions, various Docker containers). Switching from one environment to another is instant, which is ideal for developers and administrators juggling several projects and platforms.

Port forwarding and access to services

The Remote extensions offer mechanisms such as port forwarding or SSH tunneling to access web applications or services on the remote side directly from your local browser. For example, a service started on a remote server (port 8080) can be viewed through http://localhost:8080 without being exposed publicly on the Internet.

Real-world use cases

The Remote extensions cover many scenarios:

  • Test remote web applications thanks to port forwarding.
  • Debug in an environment close to production to avoid differences between systems.
  • Collaborate as a team using an identical centralized environment for everyone.
  • Simplify hybrid Windows/Linux development with Remote-WSL.
  • Guarantee the reproducibility of a project with Remote-Containers.
  • Reach locked-down environments through Remote-Tunnels, without configuring SSH.

How do you install and configure the Remote extensions?

You can choose between installing the pack or the extensions individually. In our case, we will install the Remote SSH extension.

Installing the Remote SSH extension in Visual Studio Code is simple and can be done directly from the command line. Here are the steps to install and configure this extension.

Installing the extension

First, open Visual Studio Code and go to the integrated terminal (Terminal menu, then New Terminal). To install the Remote SSH extension, use the following command:

Terminal window
code --install-extension ms-vscode-remote.remote-ssh

This command downloads and installs the extension directly from the VS Code marketplace.

You can also install it by searching for it in the VS Code extensions view.

VS Code remote extensions

Configuring an SSH connection

Once the extension is installed, you must configure the SSH connections. You can start by editing your SSH configuration file, which stores the connections: ~/.ssh/config on Linux and macOS, %USERPROFILE%\.ssh\config on Windows. To add a new remote server, open it in VS Code with the following command:

Terminal window
code ~/.ssh/config

On Windows, in PowerShell, the equivalent command is:

Terminal window
code $HOME\.ssh\config

You can also, on every system, open the VS Code command palette (F1) and choose Remote-SSH: Open SSH Configuration File..., which offers your user's file.

Then add the following configuration for your remote server:

Host my-server
HostName 192.0.2.10
User username
IdentityFile ~/.ssh/id_ed25519

Each line has a role: Host is the short name that will appear in VS Code, HostName the server address (here a documentation address, replace it with yours), User the login account and IdentityFile the private key to present. VS Code reads this file and offers each Host as a target; one more server means one more block.

Connecting to the remote server

VS Code remote extensions

Once the server is added to the list of SSH targets, simply click the server name in the Remote Explorer to start the connection. VS Code opens a new window dedicated to this connection and you are connected to the remote machine. On the first connection, VS Code installs its server on the remote machine automatically (in ~/.vscode-server): this first connection is therefore a bit longer than the following ones.

Checking and testing

Once connected, you should see the file explorer showing the directories of the remote server. To check that everything works, try opening a file and making changes to it. You can also run commands in the integrated terminal of VS Code to interact with the server.

Configuring port forwarding

Once connected to your remote server through Remote SSH in VS Code, you can configure port forwarding using the Ports tab located next to the integrated terminal.

VS Code remote extensions

  1. Open the Ports tab: Connect to the remote server, then click the Ports tab at the bottom of the interface, next to the terminal.
  2. Add a port: In the Ports tab, click the icon on the Forward a Port button or + to add a new port forward. Enter the number of the remote port you want to forward, for example 8080, then the matching local port on which you want to listen.
  3. Check the connection: The forwarded port appears in the list and you can reach it from your local browser through http://localhost:8080.

Installing extensions on the remote machine from the extensions view

Installing extensions on the remote machine is simple from the extensions view in VS Code.

VS Code remote extensions

  1. Open the extensions view: On the left of the VS Code interface, click the Extensions icon to open the extensions view.
  2. Search for the extension: In the search bar, type the name of the extension you want to install. For example, search for "Python" if you work with that language.
  3. Install the extension: click Install in SSH: [server name] to install the extension directly on the remote machine. The extension will then be available and work as if it were installed locally.

What are the best practices for Remote-SSH?

With Remote-SSH, VS Code reads, edits and runs code on the server with the rights of the account you use, and it leaves a component installed there. A few habits keep an editor mistake from becoming an incident on the machine. The first three are about security: do not negotiate them.

  1. Do not develop on production environments: it is essential to separate development and production environments. Work on test or staging servers to avoid the risks of code errors on critical systems.
  2. Do not connect with the root account: for security reasons, avoid logging in as root. Prefer unprivileged users to reduce the risk of altering critical system files.
  3. Protect your SSH keys: store your SSH keys securely, ideally with passphrases to add an extra layer of protection. Never share your private keys and use key management methods such as SSH-Agent to secure connections.

Three other habits concern the exposure and the operation of the server. Ignoring them does not put the machine at risk right away, but it costs you over time:

  • Forward ports with care. Only forward the ports you need, and check that access to them stays protected: every forwarded port is one more door to a service on the server.
  • Manage disk space. VS Code Server and its extensions are installed in ~/.vscode-server, in the home directory of the connected account, and grow with versions and extensions. Keep an eye on the space they take on servers where space is limited.
  • Watch performance. Keep an eye on the resource usage (CPU, memory) of the server, especially if several people connect to it: VS Code Server and its extensions consume resources too. Monitoring lets you prevent slowdowns before they cut the service.

Conclusion

Whether you go through SSH, WSL, Dev Containers or Tunnels, you work directly in the target environment: you debug there as you would locally and you reach its services through port forwarding. For a server, Remote-SSH is the shortest path: a ~/.ssh/config file, a key, and VS Code does the rest.

Key takeaways

  • The Remote extensions separate the editor (local) from execution (remote).
  • Remote-SSH develops on a server, Dev Containers in a container, WSL under Windows.
  • The configuration comes from the user's SSH file: ~/.ssh/config (Linux, macOS) or %USERPROFILE%\.ssh\config (Windows).
  • Each server is a Host block in this file, with HostName, User and IdentityFile.
  • Connect with an SSH key protected by a passphrase, with an unprivileged account, never as root.
  • Only forward the necessary ports and do not develop on a production server.

Next steps

To go further, move on to the reproducible environment in a container, or dig deeper into SSH: tunnels, including the hop through an intermediate server (ProxyJump), and the configuration of the server itself.

FAQ: VS Code Remote