To remotely work on a server in VSCode via SSH start by installing the extension Remote - SSH by Microsoft:
Once the extension is installed, click the remote connection button on the bottom left of your VSCode window:
In the command palette that pops up, choose Connect to host...:
Then choose Configure SSH Hosts:
Select the first config file it lists. For example, my SSH config file is located at
In your SSH config file, we’re going to add connection information for the server you want to connect to. Here is what that connection information should look like:
Host my-server HostName your.server.ip.address User root
my-serverto be some alias for this connection.
your-server-ip-addressto match the IP address of the server you’re connecting to.
rootto whatever user you connect to this server as.
After adding these lines, save your changes.
Let’s now connect to the server we just configured.
Click the connection icon (bottom left of VSCode window) again. In the command palette that pops up, choose Connect Current Window to Host... and choose the host you just added:
This should establish a new remote connection with your server.
Note that anything you do in this window will now occur on your server.
You can tell when a VSCode window is connected to the server by the remote development button/icon on the bottom left of the screen:
Not all the VSCode extensions you’ve installed locally will be automatically be available when connected to your server; you’ll need to install them there.
To do this, open your Extensions and find any extensions that are greyed out and choose Install in SSH.
I suggest only installing extensions you really need/use, as an excessive amount of extensions can slow down the remote development process.
If you’re working on a budget server with not a lot of RAM, you might run into issues where the connection frequently stalls while using the Remote SSH plugin.
Symptoms include repeatedly seeing the dialog Disconnected. Attempting to reconnect...
Or being stuck on the notification Setting up SSH Host [...] Initializing VSCode
If this happens to you, see my guide: VSCode Remote SSH Keeps disconnecting.