Using Visual Studio Code to Edit Files Remotely Over SSH

Visual Studio Code is a popular source code editor made by Microsoft. It can be configured to remotely edit the files on your hosting account over an SSH connection. We strongly recommend that you set up key-based SSH authentication for use with Visual Studio Code.

NOTE: In order to connect to your account with Visual Studio Code, there is also a configuration change that needs to be enabled for your hosting account on the server. Please contact our support team about this, otherwise you won't be able to use Visual Studio Code over SSH.

The configuration for SSH connections in Visual Studio Code is described in detail in the Remote Development using SSH article in the official documentation of the editor. You should start by setting up your Visual Studio Code installation as described in that article. In particular, you have to install the "Remote SSH" extension.

After your editor has been set up, there are two settings in it that you have to change. The first one is "Remote.SSH: Remote Server Listen On Socket" and it needs to be enabled.

To change it, you should first open the Settings dialog by pressing Ctrl+,.

In the search field, enter Remote.SSH: Remote Server Listen On Socket. The option will appear. It needs to be checked:

VS Code Settings Remote Server Listen On Socket

The other setting that you have to add is named Remote.SSH: Server Install Path. You can find it the same way:

VS Code Settings Server Install Path

When it appears, you should click on the "Add Item" button and enter the server name of your hosting account (it can be found in the welcome email or on the left pane of the Control Panel of your hosting account) and the following path:

/home/$USER/.local/vscode-server

In the following example, the username is example and the server name is s999.sureserver.com. The username and the server name of your account will be different; you should use the values that apply to your account. For this example, the setting should be as follows:

ItemValue
s999.sureserver.com/home/$USER/.local/vscode-server

Click "OK" to save the changes.

At this point, you can start a remote connection by pressing F1 and typing Remote-SSH: Connect. You will get a prompt to enter the location of your account. You should enter [email protected]. You may be prompted for your password or passphrase in order to authenticate to the SSH server:

VS Code Connect SSH

If the connection is successful, you will be prompted to choose the platform on the remote host; it's Linux:

VS Code SSH Select Remote Platform

You should now be able to edit your files remotely over SSH using Visual Studio Code.