13 min read

How to Set Up a Remote Development Environment with VS Code and Localtonet

Use VS Code Remote SSH over a Localtonet tunnel to develop on a remote Linux machine from anywhere. No VPN, no static IP, no open firewall ports required.

💻 VS Code · Remote Development · SSH · Localtonet · 2025

How to Set Up a Remote Development Environment with VS Code and Localtonet

Your development server is under your desk, in a closet, or at home while you are at a coffee shop. This guide shows you how to connect VS Code to a remote machine from anywhere using SSH over a Localtonet tunnel. No VPN, no static IP, no firewall changes. You get full IntelliSense, debugging, and terminal access as if the machine were right next to you.

🖥️ Full remote IDE experience 🔒 SSH encrypted connection 🌍 Works from anywhere ⚡ No VPN required

Why Develop on a Remote Machine

There are plenty of situations where the machine you want to code on is not the machine sitting in front of you. Maybe you have a powerful Linux workstation at home that you want to use from your laptop at work. Maybe your project only runs on Linux but you are on a Mac. Maybe the codebase is too large to run comfortably on a thin client or tablet. Maybe you just want to keep everything on one machine regardless of where you are.

Use your best hardware from anywhere Run builds, tests, and servers on your powerful desktop while working from a lightweight laptop or tablet.
🐧 Linux environment on any client Your project needs Linux. Your daily machine is Windows or macOS. Remote development solves this without a VM.
🔒 Code never leaves the server Source code stays on the remote machine at all times. Your laptop only sends keystrokes and receives screen updates.
🌍 Same environment everywhere One machine, one setup, one set of dependencies. No more "works on my machine" problems between team members.
📱 Code from a browser VS Code's remote SSH setup also works from vscode.dev in a browser. No desktop app needed on the client device.
🏠 Home server or NAS Turn a Raspberry Pi, home server, or NAS into a personal development box accessible from any device.

How It Works

The VS Code Remote SSH extension connects to a remote machine over SSH and installs a small VS Code Server on it. From that point on, your local VS Code window is just a UI. All file operations, terminal commands, extensions, and debuggers run on the remote machine. The experience feels completely local.

The problem is that SSH requires a network path to the remote machine. If the remote is behind a home router, a CGNAT connection, or a corporate firewall, you cannot reach its SSH port from the internet. Localtonet solves this by creating an encrypted TCP tunnel that exposes the SSH port on a public relay address. VS Code connects to that relay address and the tunnel forwards the connection to your machine at home.

Connection flow

VS Code (your laptop) → Localtonet relay address → Localtonet tunnel → SSH port on your remote machine → VS Code Server

Prerequisites

What you need before starting

  • A remote machine running Linux (Ubuntu, Debian, Fedora, or similar) with an SSH server installed
  • A local machine with VS Code installed and the Remote SSH extension
  • A Localtonet account — create one free here
  • Localtonet installed on the remote machine and authenticated with your AuthToken
  • SSH key pair for passwordless authentication (recommended)
Install the Remote SSH extension

Open VS Code, press Ctrl+Shift+X (or Cmd+Shift+X on macOS), search for Remote - SSH and install the extension published by Microsoft. You can also install the full Remote Development extension pack which includes Remote SSH, Dev Containers, and WSL in one click.

Step 1: Set Up SSH on the Remote Machine

Run these commands on the remote machine to install and enable the SSH server. If SSH is already running, skip to the key setup.

# Install OpenSSH server
sudo apt update
sudo apt install -y openssh-server

# Enable and start the SSH service
sudo systemctl enable ssh
sudo systemctl start ssh

# Confirm it is running
sudo systemctl status ssh

Now set up SSH key authentication from your local machine so you do not need to type a password every time you connect. Run this on your local machine:

# Generate a key pair if you do not already have one
ssh-keygen -t ed25519 -C "your_email@example.com"

# Copy your public key to the remote machine
# Replace remote-user and remote-ip with your actual values
ssh-copy-id remote-user@remote-ip
No direct access to the remote machine yet?

If you are setting this up for the first time and can only reach the remote machine on your local network, copy the SSH key while you are on the same network. Once the Localtonet tunnel is running, you will connect exclusively through the relay address and no longer need direct network access.

Step 2: Create a TCP Tunnel for SSH

SSH listens on port 22 by default. You need a Localtonet TCP tunnel that forwards a public relay port to port 22 on the remote machine.

1

Install Localtonet on the remote machine

Download and authenticate Localtonet using your AuthToken from Dashboard → My Tokens.

curl -fsSL https://localtonet.com/install.sh | sh
localtonet --authtoken <YOUR_TOKEN>
2

Create a TCP tunnel for port 22

Log in to the Localtonet dashboard, go to Tunnels → New Tunnel, select TCP, set local IP to 127.0.0.1 and port to 22. Click Create.

3

Note the relay address

The dashboard shows the public relay address for your tunnel. It looks like example.localto.net with a port number such as 33221. You will use this host and port in your SSH config.

Reserve a fixed port

TCP ports are assigned dynamically by default. If you want the relay port to stay the same every time, reserve a port via Add-ons → Reserved Ports in the dashboard. A fixed port means your SSH config never needs to change.

Step 3: Connect VS Code via Remote SSH

With the tunnel running, configure your local SSH client to use the relay address. Then VS Code can connect through it transparently.

1

Edit your SSH config file

Open ~/.ssh/config on your local machine (create it if it does not exist) and add an entry for your remote machine. Replace the values with your actual relay address, port, username, and key path.

Host my-dev-server
    HostName example.localto.net
    Port 33221
    User remote-user
    IdentityFile ~/.ssh/id_ed25519
    ServerAliveInterval 60
2

Test the SSH connection from your terminal

Before opening VS Code, confirm the connection works from the command line. If it connects successfully, VS Code will work too.

ssh my-dev-server
3

Connect with VS Code Remote SSH

In VS Code, press F1 (or Ctrl+Shift+P) to open the Command Palette and run Remote-SSH: Connect to Host. Select my-dev-server from the list. VS Code opens a new window connected to your remote machine. On first connection it installs VS Code Server on the remote automatically.

4

Open a folder on the remote machine

Once connected, go to File → Open Folder and navigate to your project directory on the remote machine. VS Code loads the folder and all extensions run on the remote. Your terminal, IntelliSense, and debugger all operate on the remote filesystem.

What works over the remote connection

  • Full IntelliSense, code completion, and go-to-definition
  • Integrated terminal running on the remote machine
  • Debugger with breakpoints and variable inspection
  • Extensions installed and running on the remote
  • Git integration against the remote repository
  • Port forwarding — expose a local port on the remote to your laptop

Step 4: Keep the Tunnel Running Permanently

If the remote machine restarts, the Localtonet tunnel goes down and VS Code can no longer connect. Use Localtonet service mode to register the tunnel as a systemd service that starts automatically on boot. Run these commands on the remote machine:

sudo localtonet --install-service --authtoken <YOUR_TOKEN>
sudo localtonet --start-service --authtoken <YOUR_TOKEN>

Verify the service is running:

systemctl status localtonet
journalctl -u localtonet -f

Now the Localtonet tunnel starts automatically when the remote machine boots. Your SSH relay address is always reachable and VS Code can connect at any time.

Tips for a Better Remote Development Workflow

📦 Install extensions on the remote, not locally

When you are connected to a remote host, VS Code shows two sections in the Extensions panel: local extensions and remote extensions. Language servers, linters, formatters, and debuggers should be installed on the remote side so they run where the code is. UI extensions like themes can stay local.

🔀 Use VS Code port forwarding for web apps

When your remote app starts a web server on port 3000, VS Code can forward that port to your local machine automatically. Open the Ports tab in the bottom panel, click Forward a Port, and enter the port number. You can then open http://localhost:3000 in your local browser and it connects to the app running on the remote machine.

⚙️ Set ServerAliveInterval in SSH config

Add ServerAliveInterval 60 to your SSH config entry as shown above. This sends a keepalive packet every 60 seconds and prevents the connection from dropping when there is no activity for a while.

📁 Keep your dotfiles and tools on the remote

Since you are working directly on the remote machine, install your full development environment there: your shell configuration, Git setup, language runtimes, and CLI tools. VS Code's terminal on the remote behaves exactly like a direct SSH session.

🌐 Connect from a browser with no desktop VS Code

If you are on a machine where you cannot install VS Code, open vscode.dev in your browser, install the Remote SSH extension from the Extensions panel, and connect using the same SSH config. You get a full VS Code experience in the browser with no local installation required.

🔑 Use a custom domain for a permanent relay address

If you attach a custom domain to your Localtonet tunnel, the SSH hostname in your config never changes. Go to Tunnels → your tunnel → Custom Domain in the Localtonet dashboard, add your domain, and update the HostName in your SSH config to match.

Frequently Asked Questions

Does this work if the remote machine is behind CGNAT or a router I cannot configure?

Yes. Localtonet makes an outbound connection from the remote machine to the relay server. It does not require any inbound firewall rules or port forwarding on the router. CGNAT, double NAT, and restricted corporate networks are all supported as long as the remote machine has outbound internet access.

How does this compare to VS Code's built-in Remote Tunnels feature?

VS Code Remote Tunnels uses Microsoft's infrastructure and requires a GitHub or Microsoft account for authentication. It also has usage limits on the number of tunnels and bandwidth. The approach in this guide uses standard SSH over a Localtonet TCP tunnel, which gives you full control over authentication, does not depend on Microsoft's relay service, and has no Microsoft account requirement. SSH is also a more universal protocol that works with many other tools beyond VS Code.

Can I use this with a Raspberry Pi as the remote machine?

Yes. Raspberry Pi OS ships with SSH server available and Localtonet supports ARM builds for Raspberry Pi. Install the ARM binary using the one-liner installer and follow the same steps. Performance depends on the Pi model — a Pi 4 or Pi 5 handles VS Code Server well for most projects.

Is the connection secure?

Yes. The SSH protocol provides end-to-end encryption between your local VS Code and the remote VS Code Server. Localtonet carries the encrypted SSH traffic through the tunnel without being able to inspect its contents. Using SSH key authentication instead of passwords adds another layer of security on top.

Can multiple people connect to the same remote machine at the same time?

Yes. SSH supports multiple concurrent sessions. Each person connects with their own SSH key and gets their own independent session on the remote machine. VS Code Server handles multiple client connections to the same host. Make sure the user accounts on the remote machine have appropriate file permissions so sessions do not interfere with each other.

What happens to my session if the connection drops?

VS Code shows a connection error and the remote window closes. Any unsaved files are lost since they live on the remote. To protect against this, enable VS Code's auto-save feature under File → Auto Save. Running processes on the remote (like a dev server) continue uninterrupted even when your connection drops, since they are not tied to your local session.

Your Remote Machine, One SSH Command Away

Install Localtonet on your remote machine, create a TCP tunnel for port 22, and add one entry to your SSH config. From that point on, VS Code connects to your remote environment from anywhere in the world.

Create Free Localtonet Account →

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

support