VS Code Remote-SSH: Develop on Remote Servers Locally

Introduction
Have you ever needed to edit files on a remote Linux server, only to find yourself stuck using vim or nano in a terminal? Or perhaps you've been frustrated by the limitations of editing code over a slow SSH connection with no IntelliSense, no debugging, and no extensions?
VS Code Remote-SSH solves all of this. It lets you open any folder on a remote machine over SSH and work with it as if it were on your local computer — with full IntelliSense, debugging, extensions, and a familiar interface.
In this guide you'll learn:
- How Remote-SSH works under the hood
- Setting up SSH keys for passwordless authentication
- Installing and configuring the Remote-SSH extension
- Connecting to a remote server and opening folders
- Port forwarding for previewing web apps
- Managing multiple remote hosts
- Tips and best practices for productive remote development
How VS Code Remote-SSH Works
When you connect to a remote machine, VS Code installs a small VS Code Server on the remote host. Your local VS Code client communicates with this server over SSH. The server handles:
- File system access
- Language servers (IntelliSense, autocomplete)
- Debugging sessions
- Extension execution
This means language extensions run on the remote machine — where your code actually lives — while the UI runs locally. The result is a snappy, responsive editing experience with full IDE capabilities.
Prerequisites
Before you begin, you need:
- VS Code installed locally (download here)
- A remote server accessible over SSH (Linux/macOS; Windows servers also supported)
- SSH client installed on your local machine
- macOS/Linux: built-in
sshcommand - Windows: OpenSSH (included in Windows 10+) or Git Bash
- macOS/Linux: built-in
Step 1: Set Up SSH Key Authentication
Using SSH keys is more secure and more convenient than password authentication — especially important for frequent remote connections.
Generate an SSH Key Pair
If you don't already have one, generate a key pair on your local machine:
ssh-keygen -t ed25519 -C "your-email@example.com"Accept the default path (~/.ssh/id_ed25519) or specify a custom one. Add a passphrase for extra security (optional but recommended).
Copy the Public Key to the Remote Server
ssh-copy-id user@your-remote-hostOr manually append the public key:
cat ~/.ssh/id_ed25519.pub | ssh user@your-remote-host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"Test Passwordless Login
ssh user@your-remote-hostYou should connect without being prompted for a password.
Step 2: Install the Remote-SSH Extension
- Open VS Code
- Go to the Extensions panel (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "Remote - SSH"
- Install the extension published by Microsoft
You'll also see Remote - SSH: Editing Configuration Files — install this too for a better config editing experience.
After installation, a new icon appears in the Activity Bar (bottom-left) — the Remote Explorer.
Step 3: Configure SSH Hosts
VS Code reads your SSH connections from the standard ~/.ssh/config file. You can edit it directly or let VS Code manage it.
Open SSH Config
Press Ctrl+Shift+P (or Cmd+Shift+P), type "Remote-SSH: Open SSH Configuration File", and select ~/.ssh/config.
Add a Host Entry
Host my-dev-server
HostName 192.168.1.100
User ubuntu
IdentityFile ~/.ssh/id_ed25519
Port 22
Host work-server
HostName work.example.com
User chanh
IdentityFile ~/.ssh/work_key
ForwardAgent yesKey fields explained:
| Field | Description |
|---|---|
Host | Alias name (used in VS Code's host list) |
HostName | IP address or domain name |
User | SSH username |
IdentityFile | Path to private key |
Port | SSH port (default: 22) |
ForwardAgent | Forward local SSH agent (useful for git operations on remote) |
Step 4: Connect to a Remote Host
Method 1: Remote Explorer
- Click the Remote Explorer icon in the Activity Bar
- Hover over your host under "SSH Targets"
- Click the folder icon to open the remote host in a new window
- Or click the arrow icon to connect in the current window
Method 2: Command Palette
- Press
Ctrl+Shift+P/Cmd+Shift+P - Type "Remote-SSH: Connect to Host"
- Select your configured host from the list
- VS Code opens a new window connected to the remote
First Connection
On first connection, VS Code will:
- Download and install VS Code Server on the remote machine
- Set up the server in
~/.vscode-server/on the remote - Open a new VS Code window — the title bar shows
[SSH: hostname]to confirm you're connected
From here, open a folder with File > Open Folder and browse the remote file system.
Step 5: Open a Remote Project
Once connected, navigate to your project:
File > Open Folder(orCtrl+K Ctrl+O)- Browse to your project directory on the remote server
- Click OK
VS Code loads the remote folder. You can now:
- Browse and edit files in the Explorer panel
- Open an integrated terminal (
Ctrl+`) — this runs on the remote machine - Use IntelliSense powered by the remote language server
- Run and debug code on the remote host
The Integrated Terminal
The terminal inside a Remote-SSH window is a real shell session on the remote server. Any command you run executes remotely:
# This runs on the remote machine
ls /home/ubuntu/projects
python3 --version
docker psStep 6: Install Extensions on the Remote
Some extensions need to run on the remote server (e.g., language extensions, linters). Others run locally (themes, keybindings).
To install an extension on the remote:
- Open the Extensions panel while connected
- Search for the extension
- Click "Install in SSH: hostname"
Extensions marked with a remote indicator run server-side. VS Code automatically suggests migrating local extensions to the remote when you connect.
Recommended Remote Extensions
| Extension | Purpose |
|---|---|
| Python / Pylance | Python IntelliSense |
| Go | Go language support |
| ESLint / Prettier | JS/TS linting and formatting |
| GitLens | Enhanced Git integration |
| Docker | Docker container management |
| Remote - Containers | Dev containers on remote |
Step 7: Port Forwarding
When you run a web app on a remote server (e.g., localhost:3000), you can't access it from your local browser directly. VS Code's port forwarding tunnels the remote port to your local machine automatically.
Automatic Port Forwarding
VS Code detects when a process binds to a port (e.g., npm run dev) and offers to forward it automatically. Click the notification toast to open it in your local browser.
Manual Port Forwarding
- Open the Ports panel (in the bottom panel area)
- Click "Forward a Port"
- Enter the remote port number (e.g.,
3000) - VS Code assigns a local port (often the same number)
- Open
http://localhost:3000in your local browser
Persistent Port Forwarding
Add frequently-forwarded ports to your workspace settings:
{
"remote.SSH.defaultForwardedPorts": [
{ "localPort": 3000, "remotePort": 3000 },
{ "localPort": 5432, "remotePort": 5432 }
]
}Managing Multiple Remote Environments
Organizing Hosts with Labels
Use descriptive Host aliases in your SSH config to keep things organized:
# Development servers
Host dev-api
HostName 10.0.1.10
User ubuntu
IdentityFile ~/.ssh/dev_key
Host dev-db
HostName 10.0.1.11
User postgres
IdentityFile ~/.ssh/dev_key
# Production (read-only access)
Host prod-web
HostName prod.example.com
User deploy
IdentityFile ~/.ssh/prod_keyWorkspace Files for Remote Projects
Save a .code-workspace file to quickly reopen remote folders:
{
"folders": [
{
"uri": "vscode-remote://ssh-remote+my-dev-server/home/ubuntu/api",
"name": "API Service"
},
{
"uri": "vscode-remote://ssh-remote+my-dev-server/home/ubuntu/frontend",
"name": "Frontend"
}
]
}Common Workflows
Workflow 1: Python Development on a GPU Server
# SSH config
Host gpu-server
HostName gpu.mylab.com
User researcher
IdentityFile ~/.ssh/lab_key- Connect via Remote-SSH
- Open your Python project folder
- Install Python and Jupyter extensions on remote
- Select the remote Python interpreter / virtual environment
- Run and debug ML scripts directly on the GPU server
- Forward Jupyter port (8888) to view notebooks locally
Workflow 2: Docker Development on a VPS
- Connect to your VPS via Remote-SSH
- Install the Docker extension on remote
- Manage containers, images, and volumes from VS Code's Docker panel
- Open terminals inside containers directly from VS Code
- Forward application ports for local browser testing
Workflow 3: Git Operations on Remote
When your SSH agent is forwarded (ForwardAgent yes), git operations on the remote use your local SSH keys — no need to copy keys to the server.
# On remote, inside VS Code terminal
git clone git@github.com:yourname/yourrepo.git
git push origin main # Uses your local SSH key via agent forwardingTips & Best Practices
Performance Optimization
Use a faster SSH cipher for high-latency connections:
Host fast-server
HostName server.example.com
User ubuntu
Ciphers aes128-gcm@openssh.com
Compression yesUse connection multiplexing to reuse SSH connections:
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600Create the sockets directory:
mkdir -p ~/.ssh/socketsWorkspace Settings vs User Settings
Settings in .vscode/settings.json inside the remote project override user settings. Use this to configure remote-specific settings:
{
"python.defaultInterpreterPath": "/home/ubuntu/.venv/bin/python",
"editor.formatOnSave": true,
"terminal.integrated.defaultProfile.linux": "bash"
}Keep VS Code Server Updated
VS Code Server updates automatically when you update VS Code locally. To manually reinstall the server (e.g., after a failed update):
Ctrl+Shift+P→ "Remote-SSH: Kill VS Code Server on Host"- Reconnect — VS Code will reinstall the server
Using Jump Hosts (Bastion Servers)
If your server is behind a bastion/jump host:
Host bastion
HostName bastion.example.com
User ubuntu
IdentityFile ~/.ssh/id_ed25519
Host internal-server
HostName 10.0.0.50
User ubuntu
IdentityFile ~/.ssh/id_ed25519
ProxyJump bastionVS Code handles the multi-hop SSH connection transparently.
Troubleshooting Common Issues
"Could not establish connection to server"
Causes and fixes:
- Wrong hostname/IP — verify with
ssh user@hostin terminal - Firewall blocking port 22 — check remote firewall rules
- SSH service not running — run
sudo systemctl status sshon remote - Wrong key — ensure
IdentityFilepoints to the correct private key
"VS Code Server failed to start"
# On remote, remove old server installation and reconnect
rm -rf ~/.vscode-server/Then reconnect — VS Code will reinstall the server.
Extension Not Available on Remote
Some extensions don't support remote execution. Check the extension's marketplace page for the "Remote Development" badge. For unsupported extensions, consider alternatives or run them locally.
Slow Connection / High Latency
- Enable SSH compression (
Compression yesin config) - Use a faster cipher (
Ciphers aes128-gcm@openssh.com) - Consider using VS Code Tunnels for HTTPS-based tunneling (no open SSH port required)
VS Code Remote-SSH vs Alternatives
| Tool | Pros | Cons |
|---|---|---|
| Remote-SSH | Full VS Code experience, free, works with any SSH server | Requires open SSH port |
| Remote Tunnels | Works through firewalls, no SSH port needed | Requires GitHub account |
| Dev Containers | Reproducible environments | Requires Docker on remote |
| Codespaces | Zero local setup | Cost, GitHub dependency |
| JetBrains Gateway | JetBrains IDE support | Paid for full features |
Remote-SSH is the best starting point for most developers — it's free, powerful, and works with any server you can SSH into.
Summary
VS Code Remote-SSH transforms how you work with remote servers:
✅ Full IntelliSense, debugging, and extensions on remote machines
✅ Integrated terminal that runs directly on the remote server
✅ Automatic port forwarding for local browser access
✅ Works with any SSH-accessible Linux, macOS, or Windows server
✅ Zero configuration on the remote beyond SSH access
Once you try remote development with VS Code, you'll never go back to editing over plain SSH again. The productivity gains — IntelliSense, multi-file refactoring, integrated debugging — are immediate and significant.
Next steps to explore:
- Dev Containers — containerized development environments
- Remote Tunnels — connect without an open SSH port
- GitHub Codespaces — cloud-hosted development environments
📬 Subscribe to Newsletter
Get the latest blog posts delivered to your inbox every week. No spam, unsubscribe anytime.
We respect your privacy. Unsubscribe at any time.
💬 Comments
Sign in to leave a comment
We'll never post without your permission.