Straight to the Point

Goal: use Visual Studio Code (aka vscode) to develop on a remote server over SSH with a local-like experience. Notebook support is especially smooth with the VS Code notebook extensions.

For consistency, I’ll use these terms:

  • Visual Studio Code → vscode
  • Remote server (usually Linux) → remote server
  • Local machine (Windows/macOS/Linux) → host
  • Remote-SSH extension → remote extension
  • Jupyter Notebook → notebook
  • Extensions → plugins

VS Code’s success owes a lot to open source and a vibrant extension ecosystem. Remote development is powered by the Remote-SSH plugin.

Remote-SSH

Remote dev isn’t limited to SSH:

  • Windows host to local WSL
  • Local Docker containers
  • GitHub Codespaces

First step: download VS Code and install the remote extension. After installation, a remote icon appears in the lower-left corner.

If the extension fails to install, update VS Code or reinstall.

Install remote extension

Configure Server Info

Click the lower-left remote icon and choose the appropriate target. For SSH, pick Connect to Host. Two ways to configure:

Method 1: ssh command

SSH login

Enter a full ssh command directly. Replace username with your account, host with IP or domain, port with the SSH port. For a jump host, use -J with jump user/host/port.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Default port 22
ssh username@host:port
# Examples:
# ssh yuesir@127.0.0.1:22
# ssh yuesir@vccv.cc:22

# With jump host
ssh username@host:port -J username@host:port
# Example:
# Jump host A: user yuesir, host 192.168.0.1, port 22
# Target B: user yueqingyou, host 192.168.0.2, port 2222
# ssh yueqingyou@192.168.0.2:2222 -J yuesir@192.168.0.1:22

Method 2: config file

After connecting once, VS Code writes the config into your SSH config. Choose Connect to Host -> Configure SSH Hosts, usually ~/.ssh/config (e.g., /Users/yuesir/.ssh/config).

Config file

Two templates (with/without jump). Host is just a nickname; HostName is the actual host/IP.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# No jump host
Host MyServer
  HostName <server-host>
  Port <port>
  User <username>
  
# With jump host
Host TargetServer
  HostName 192.168.0.2
  Port 2222
  User yueqingyou
  ProxyJump yuesir@192.168.0.1:22

If it hangs on “Downloading VS Code Server”

This happens when the remote can’t reach the VS Code server URL (offline or blocked). Workaround: download the server locally and upload manually. References:

Configure SSH Key Login

Typing passwords repeatedly is painful, especially with flaky VPNs. Use key-based auth—it’s also what VS Code recommends:

We recommend using key-based authentication (otherwise you may be prompted multiple times).

Check for existing keys on the host

1
2
3
4
5
# Check for .ssh directory
ls -la ~ | grep .ssh
# If present, check for key files
ls -la ~/.ssh | grep id_rsa
ls -la ~/.ssh | grep id_ed25519

If you already have keys, skip creation.

Existing keys

Quick crypto note: RSA vs Ed25519. Summary:

Commandssh-keygen -t rsa -b 4096ssh-keygen -t ed25519
TypeRSAEd25519
PerformanceSlower (still fine)Faster
SecurityHighHigher
CompatibilityBetter with legacy systemsVery old systems may not support

Default to ssh-keygen -t ed25519.

Create a key pair on the host

On Windows open cmd/PowerShell; on macOS/Linux use Terminal. Example on Windows 10:

Generate keys

Prefer Ed25519, fall back to RSA:

1
2
3
4
5
# Ed25519
ssh-keygen -t ed25519

# RSA
ssh-keygen -t rsa -b 4096

Press Enter to accept defaults and empty passphrase. Keys are stored in ~/.ssh (e.g., C:/Users/<user>/.ssh or /home/<user>/.ssh). You’ll see id_ed25519.pub (public) and id_ed25519 (private). Keep the private key secret.

Add the public key to the remote server

Cloud providers often let you paste/upload a key when provisioning (see screenshot below).

Add key in cloud console

If you just have SSH access, use the command-line or manual edit:

1
2
# From host
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@host:port

Or manually append the .pub content to ~/.ssh/authorized_keys on the server (create the file if missing), then set permissions:

1
2
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Restart the SSH service if needed to apply key auth.

Beyond Remote-SSH, these make Python/Notebook life easier:

  • ms-python.python (Python tooling, debugger, linting)
  • ms-toolsai.jupyter (Notebook support)
  • ms-toolsai.jupyter-renderers
  • ms-toolsai.jupyter-keymap
  • ms-toolsai.jupyter-cell-tags
  • ms-toolsai.vscode-jupyter-powertoys
  • ms-toolsai.datawrangler (data wrangling)
  • ms-toolsai.data-wrangler-vscode
  • ms-toolsai.data-wrangler-native-notebook
  • ms-toolsai.data-wrangler-lsp
  • ms-toolsai.data-wrangler-insiders
  • ms-toolsai.data-wrangler-debug
  • ms-toolsai.data-wrangler-darwin-x64
  • ms-toolsai.data-wrangler-darwin-arm64
  • ms-toolsai.data-wrangler-windows-x64
  • ms-toolsai.data-wrangler-windows-arm64

The last few are platform-specific binaries; VS Code will fetch the right one automatically.

Final Thoughts

Once SSH and keys are set, connecting is just a click. With the Python and Jupyter extensions, you get a near-local dev experience while running code on the remote server. If you edit authorized_keys with vim, save and exit with:

1
2
3
:wq
# or
ZZ

Close VS Code and reconnect—if it no longer prompts for a password, key auth is working. The rest focuses on language-specific setup and notebooks.

Python

Developing remotely still requires installing language plugins on the remote side. VS Code will prompt you; just ensure you install to the server, not the host.

Install plugins on remote

I recommend managing environments with Conda:

Install the R Kernel for Jupyter with Conda
2022-10-10   #conda #r #jupyter #droplet
Due to the author's frequent use of conda to configure the R kernel jupyter notebook on Linux remote servers, some steps are forgotten over time (the main problem is that the same pit will be stepped on differently every time). After summarizing the relevant tutorials and personal experience on the internet, a guide is provided for everyone and future me to refer to.
Back Up and Migrate Conda Environments
2024-06-29   #conda #conda pack #droplet #deep learning
I recently needed to move a Conda environment. Deep learning stacks are usually tightly coupled to driver versions and package versions, so being able to package a working environment and drop it onto another box saves a lot of time.

For Notebook + R/Python integration, see the next section.

Notebook

I’ve written several notebook setup posts; note some target the older 6.x series (current releases are 7.x).

If you’re new to notebooks, see the install guide and official docs.

If you’d like a detailed walkthrough, drop a comment (I’ll try not to bail ~~).

R + Notebook

R isn’t limited to RStudio / RStudio Server. Paired with Notebook, visualization can be even smoother.

Install the R Kernel for Jupyter with Conda
2022-10-10   #conda #r #jupyter #droplet
Due to the author's frequent use of conda to configure the R kernel jupyter notebook on Linux remote servers, some steps are forgotten over time (the main problem is that the same pit will be stepped on differently every time). After summarizing the relevant tutorials and personal experience on the internet, a guide is provided for everyone and future me to refer to.
Install the R Kernel for Jupyter with Homebrew
2023-01-16   #brew #r #jupyter
I introduced in another article in the Linux remote server using conda configuration r-kernel jupyter notebook, but I found that conda for a variety of dependency conflicts are not handled well, often leading to unsuccessful installation. In macOS system locally using brew for installation is much easier and faster. Here I summarized steps for reference.

Python + Notebook

Some common issues are recorded here, though VS Code’s Notebook UI already solves most of them.

Install the R Kernel for Jupyter with Conda
2022-10-10   #conda #r #jupyter #droplet
Due to the author's frequent use of conda to configure the R kernel jupyter notebook on Linux remote servers, some steps are forgotten over time (the main problem is that the same pit will be stepped on differently every time). After summarizing the relevant tutorials and personal experience on the internet, a guide is provided for everyone and future me to refer to.

Thanks

VS Code Remote Development

Remote development over SSH