How to set up a Visual Studio Code server for remote development over Meshnet

Learn how to set up a Visual Studio Code server on Linux and macOS and access it remotely using Meshnet.

Introduction

Visual Studio Code (VS Code) is a free and open-source code editor. It is a more lightweight alternative to the Visual Studio integrated development environment (IDE). VS Code provides a heavily customizable and easy-to-use interface for most development needs.

With traveling and work from anywhere (WFA) becoming more popular, the need for a centralized and easily accessible development environment is growing. With the combination of Meshnet and the open-source project code-server, you can host your own VS Code server and securely work on all of your projects using any device from anywhere in the world.

The code-server tool creates a VS Code instance that can be accessed using an internet browser. And Meshnet ensures an encrypted network tunnel between the connecting devices and the server. This network configuration allows you to work on your projects remotely and in a secure manner.

This article contains instructions on how you can install code-server on Linux and macOS and access the created VS Code server from remote devices over Meshnet.

Install code-server

Note

Ubuntu 22.04.1 LTS distribution is used as an example in this article.

To install code-server on Linux:

  1. Open Terminal.

  2. Download and execute the installation script by running this command:

    curl -fsSL https://code-server.dev/install.sh | sh

  3. Once the script finishes, enter this command to ensure that the code-server background process is started each time the system reboots:

    sudo systemctl enable --now code-server@$USER

Tip

If you want a preview of the installation process before proceeding, you can use this command:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run

Allow connections to your VS Code server

Some changes to the code-server configuration file are required to allow connections from other devices. By default, the server listens only on 127.0.0.1:8080. This means that no other devices can reach it.

  1. Open Terminal.

  2. Open the code-server configuration file using the Nano text editor by running this command:

    nano ~/.config/code-server/config.yaml

  3. Change the IP and port combination in the first line to 0.0.0.0:8080 as shown:

  4. Press Ctrl + X, Y, and Enter to save changes and exit the file.

Note

In the same config.yaml file, you can find the login password for your VS Code server, which is necessary for every device that connects to the server.

To change the password, edit the string following password: in the config.yaml file.

Start your VS Code server

After altering the configuration file, you can restart the code-server process.

Run the following command to apply changes and restart the code-server process:

sudo systemctl restart code-server@$USER

Access your VS Code server over Meshnet

Your VS Code server is now up and running. Due to the changes in the config.yaml file, the server can be reached from the same local area network (LAN) and by your Meshnet peer devices.

To access your server using Meshnet:

  1. Copy the Nord name of the VS Code server device from the NordVPN app.

  2. Open your internet browser.

  3. Paste the copied Nord name followed by :8080/ to the URL field and press Enter. Example secret.meerkat-fuji.nord:8080/

  4. Enter the login password and click Submit.

  5. Follow the on-screen guidelines to customize your VS Code interface.

You now have access to a fully functional VS Code instance and can work on your development projects directly from the internet browser. In addition, your Meshnet peer devices can connect to your VS Code server and work on the same project in real time.

Last updated

© 2024 Nord Security. All Rights Reserved.