Remote Development using SSH
AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. Remote Development using SSH View as Markdown Ask in VS Code Ask in VS Code Insiders The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of VS Code's feature set.
Once connected to a server, you can interact with files and folders anywhere on the remote filesystem. No source code needs to be on your local machine to gain these benefits since the extension runs commands and other extensions directly on the remote machine. The extension will install VS Code Server on the remote OS; the server is independent of any existing VS Code installation on the remote OS. This lets VS Code provide a local-quality development experience - including full IntelliSense (completions), code navigation, and debugging - regardless of where your code is hosted .
Getting started Note : After reviewing this topic, you can get started with the introductory SSH tutorial . System requirements Local: A supported OpenSSH compatible SSH client must also be installed. Remote SSH host : A running SSH server on: x86_64 Debian 8+, Ubuntu 16.04+, CentOS / RHEL 7+. ARMv7l (AArch32) Raspberry Pi OS (previously called Raspbian) Stretch/9+ (32-bit). ARMv8l (AArch64) Ubuntu 18.04+ (64-bit). Windows 10 / Server 2016/2019 (1803+) using the official OpenSSH Server . macOS 10.14+ (Mojave) SSH hosts with Remote Login enabled .
1 GB RAM is required for remote hosts, but at least 2 GB RAM and a 2-core CPU is recommended. Other glibc based Linux distributions for x86_64, ARMv7l (AArch32), and ARMv8l (AArch64) should work if they have the needed prerequisites. See the Remote Development with Linux article for information prerequisites and tips for getting community supported distributions up and running. While ARMv7l (AArch32) and ARMv8l (AArch64) support is available, some extensions installed on these devices may not work due to the use of x86 native code in the extension.
Installation To get started, you need to: Install an OpenSSH compatible SSH client if one is not already present. Install Visual Studio Code or Visual Studio Code Insiders . Install the Remote-SSH extension . If you plan to work with other remote extensions in VS Code, you may choose to install the Remote Development extension pack . SSH host setup If you do not have an SSH host set up, follow the directions for Linux , Windows 10 / Server (1803+) , or macOS SSH host or create a VM on Azure .
Optional: If your Linux or macOS SSH host will be accessed by multiple users at the same time, consider enabling Remote.SSH: Remote Server Listen On Socket in VS Code User settings for improved security. In the Settings editor: See the Tips and Tricks article for details. Optional: While password-based authentication is supported, we recommend setting up key based authentication for your host. See the Tips and Tricks article for details.
Connect to a remote host To connect to a remote host for the first time, follow these steps: Verify you can connect to the SSH host by running the following command from a terminal / PowerShell window replacing user@hostname as appropriate. ssh user@hostname # Or for Windows when using a domain / AAD account ssh user@domain@hostname In VS Code, select Remote-SSH: Connect to Host... from the Command Palette ( F1 , ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) and use the same user@hostname as in step 1.
If VS Code cannot automatically detect the type of server you are connecting to, you will be asked to select the type manually. Once you select a platform, it will be stored in VS Code settings under the remote.SSH.remotePlatform property so you can change it at any time. After a moment, VS Code will connect to the SSH server and set itself up. VS Code will keep you up-to-date using a progress notification and you can see a detailed log in the Remote - SSH output channel.
Tip: Connection hanging or failing? See troubleshooting tips for information on resolving common problems. If you see errors about SSH file permissions, see the section on Fixing SSH file permission errors . After you are connected, you'll be in an empty window. You can always refer to the Status bar to see which host you are connected to. Clicking on the Status bar item will provide a list of remote commands while you are connected.
You can then open any folder or workspace on the remote machine using File > Open... or File > Open Workspace... just as you would locally! From here, install any extensions you want to use when connected to the host and start editing! Note: On ARMv7l / ARMv8l glibc SSH hosts, some extensions may not work due to x86 compiled native code inside the extension. Open a folder on a remote SSH host in a container If you are using a Linux or macOS SSH host, you can use the Remote - SSH and Dev Containers extensions together to open a folder on your remote host inside of a container.
You do not even need to have a Docker client installed locally. To do so: Follow the installation steps for installing Docker on your remote host and VS Code and the Dev Containers extension locally. Optional: Set up SSH key based authentication to the server so you do not need to enter your password multiple times. Follow the quick start for the Remote - SSH extension to connect to a host and open a folder there. Use the Dev Containers: Reopen in Container command from the Command Palette ( F1 , ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ).
The rest of the Dev Containers quick start applies as-is. You can learn more about the Dev Containers extension in its documentation . You can also see the Develop on a remote Docker host article for other options if this model does not meet your needs. Disconnect from a remote host To close the connection when you finish editing files on the remote host, choose File > Close Remote Connection to disconnect from the host.
The default configuration does not include a keyboard shortcut for this command. You can also simply exit VS Code to close the remote connection. Remember hosts and advanced settings If you have a set of hosts you use frequently or you need to connect to a host using some additional options, you can add them to a local file that follows the SSH config file format . To make setup easy, the extension can guide you through adding a host without having to hand edit this file.
Start by selecting Remote-SSH: Add New SSH Host... from the Command Palette ( F1 , ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) or clicking on the Add New icon in the SSH Remote Explorer in the Activity Bar. You'll then be asked to enter the SSH connection information. You can either enter a host name: Or the full ssh command you would use to connect to the host from the command line: Finally, you'll be asked to pick a config file to use.
You can also set the "remote.SSH.configFile" property in your User settings.json file if you want to use a different config file than those listed. The extension takes care of the rest! For example, entering ssh -i ~/.ssh/id_rsa-remote-ssh yourname@remotehost.yourcompany.com in the input box would generate this entry: Host remotehost.yourcompany.com User yourname HostName another-host-fqdn-or-ip-goes-here IdentityFile ~/.ssh/id_rsa-remote-ssh See Tips and Tricks for details on generating the key shown here.
You can manually edit this file with anything the SSH config file format supports, so this is just one example. From this point forward, the host will appear in the list of hosts when you select Remote-SSH: Connect to Host... from the Command Palette ( F1 , ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) or in the SSH Targets section of the Remote Explorer . The Remote Explorer allows you to both ope
The rest of this page is on the live site.