DEV Community

Cover image for Setting Up VS Code SSH Remote Development on OpenWrt
阿豪
阿豪

Posted on

Setting Up VS Code SSH Remote Development on OpenWrt

VS Code's Remote SSH extension requires SFTP (SSH File Transfer Protocol) support, which isn't available in Dropbear, OpenWrt's default SSH server. You'll need to switch to OpenSSH for full compatibility.

Installing OpenSSH

Follow the official OpenWrt guide to replace Dropbear with OpenSSH

Installing Modern tar

VS Code Remote requires a recent version of tar with specific features. OpenWrt's BusyBox tar is too limited:

opkg install tar
tar --version
Enter fullscreen mode Exit fullscreen mode

Configuring SSH on Your Host

Create or edit your SSH config file to simplify connections.

Windows: C:\Users\YourUsername\.ssh\config
Linux/Mac: ~/.ssh/config

Add this configuration:

Host openwrt
  HostName 192.168.56.66
  User root
  IdentityFile ~/.ssh/openwrt
Enter fullscreen mode Exit fullscreen mode

This allows you to connect with just ssh openwrt instead of typing the full command each time.

Connecting with VS Code

  1. Install the Remote - SSH extension in VS Code
  2. Press F1 or Ctrl+Shift+P to open the command palette
  3. Type "Remote-SSH: Connect to Host"
  4. Select openwrt from the list
  5. VS Code will connect and install the VS Code Server on OpenWrt

The first connection takes a few minutes as VS Code downloads and installs its server components (~50-100MB).

vscode ssh remote

Top comments (0)