Skip to content

How-to / Raspberry Pi

Develop on Raspberry Pi remotely with SSH and VS Code

Set up SSH access and VS Code Remote for professional remote Pi development. Code from any computer while your Pi handles execution.

IntermediateRemote developmentBy Vilros

Why develop remotely?

Remote development on Raspberry Pi offers several advantages:

  • No monitor required: Run your Pi headless (without a display) and code from your laptop or desktop.
  • Better performance: Use your main computer's resources for editing, debugging, and UI while the Pi handles execution.
  • Flexible workspace: Access your Pi from anywhere on your local network or over the internet.
  • Professional tools: Leverage VS Code extensions, Git integration, and terminal multiplexing with tmux or screen.

This guide covers SSH access and VS Code Remote SSH, the most popular workflow for remote Pi development.

Prerequisites

  • Raspberry Pi connected to your local network (Wi-Fi or Ethernet)
  • Raspberry Pi OS installed (Lite or Desktop version)
  • Computer with SSH client (Linux/macOS have SSH built-in; Windows 10+ includes OpenSSH)
  • Visual Studio Code installed on your computer (for VS Code Remote workflow)

Enable SSH

Method 1: During OS installation (Raspberry Pi Imager)

  1. Open Raspberry Pi Imager.
  2. Click the gear icon (⚙️) for advanced options.
  3. Check Enable SSH and set a password or add your SSH public key.
  4. Flash the SD card and boot your Pi.

Method 2: On a running Pi (Desktop)

  1. Open the Raspberry Pi Configuration tool from the main menu.
  2. Go to the Interfaces tab.
  3. Enable SSH and click OK.

Method 3: Command line

sudo systemctl enable ssh
sudo systemctl start ssh
Security tip: Change the default password immediately with passwd or set up SSH key authentication.

Connect via SSH

Find your Pi's IP address

On the Pi, run:

hostname -I

Or check your router's DHCP client list. If you enabled mDNS, you can use raspberrypi.local as the hostname.

Connect from your computer

ssh username@192.168.1.100

Replace username with your Pi username (default: pi on older OS versions) and 192.168.1.100 with your Pi's actual IP address.

Accept the host key fingerprint when prompted (first connection only), then enter your password.

Set up SSH key authentication (optional)

On your computer, generate an SSH key pair:

ssh-keygen -t ed25519 -C "your_email@example.com"

Copy your public key to the Pi:

ssh-copy-id username@192.168.1.100

You can now SSH into your Pi without entering a password.

Use VS Code Remote

The Remote - SSH extension lets you code on your Pi as if it were running locally, with full IntelliSense, debugging, and terminal access.

1. Install Remote - SSH extension

  1. Open VS Code.
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
  3. Search for Remote - SSH and install it.

2. Connect to your Pi

  1. Press F1 and type Remote-SSH: Connect to Host...
  2. Enter username@192.168.1.100 (or raspberrypi.local).
  3. VS Code will open a new window connected to your Pi.

3. Open a folder and start coding

  1. Click Open Folder and select your project directory on the Pi.
  2. Install any necessary extensions on the remote (e.g., Python, C/C++, or Node.js).
  3. Edit files, run code, and debug directly on your Pi.
Tip: Use the integrated terminal (Ctrl+`) to run shell commands on the Pi without leaving VS Code.

Headless Pi setup

To run your Pi without a monitor, configure SSH and Wi-Fi before first boot.

Pre-configure Wi-Fi and SSH

  1. Flash Raspberry Pi OS using Raspberry Pi Imager.
  2. Before ejecting the SD card, enable SSH and configure Wi-Fi in the imager's advanced settings (gear icon).
  3. Insert the SD card into your Pi and power it on.
  4. Wait ~30 seconds for the Pi to boot and connect to Wi-Fi.
  5. SSH into your Pi using raspberrypi.local or find its IP address from your router.

Once connected, update your system:

sudo apt update && sudo apt upgrade -y

Development tips

Use tmux or screen

Terminal multiplexers let you keep processes running even after disconnecting from SSH.

sudo apt install tmux
tmux new -s dev

Detach with Ctrl+B, D and reattach later with tmux attach -t dev.

Mount Pi filesystem with SSHFS (optional)

Mount your Pi's filesystem as a local drive on Linux or macOS:

sudo apt install sshfs  # On your computer
mkdir ~/pi
sshfs username@192.168.1.100:/home/username ~/pi

Access over the internet (advanced)

Use port forwarding on your router, a VPN, or a service like ZeroTier or Tailscale for secure remote access from outside your network.

Need more help?

Visit the Vilros Learn Center or contact Vilros support.