Jump to content

Cursor SSH:Setup

From jb-vpn.uk Wiki

This guide explains how to configure Cursor IDE to connect to a Raspberry Pi through the VPS SSH port forward.

Overview

[edit]

Cursor IDE (like VS Code) supports remote development via SSH. To connect to your Raspberry Pi through the VPS:

Your Computer → Cursor IDE → SSH → VPS:22223 → VPN Tunnel → Raspberry Pi (10.8.0.3:22)

Prerequisites

[edit]

SSH Port Forward Configured (Already done)

[edit]
  * Port forward: 2222310.8.0.3:22
  * Verify: sudo ssh-forward list

IONOS Firewall Rule (Required)

[edit]
  * Port 22223 must be allowed in IONOS Cloud Panel
  * See: [SSH Port Forwarding Guide](Ssh-Port-Forwarding.md)

Raspberry Pi Requirements:

[edit]
  * SSH server enabled
  * Root SSH access enabled (see step 1)
  * Network connectivity via VPN

Step-by-Step Configuration

[edit]

1. Enable SSH and Root Access on Raspberry Pi

[edit]

Enable SSH server (on Raspberry Pi):

sudo systemctl enable ssh
sudo systemctl start ssh

Or via raspi-config:

sudo raspi-config
== Navigate to: Interfacing Options → SSH → Enable ==

Enable root SSH access (on Raspberry Pi):

== Set root password (if not already set) ==
r

== Enable root login via SSH ==
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
== Or if using password auth: ==
sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config

== Restart SSH service ==
sudo systemctl restart ssh

Verify SSH is running:

sudo systemctl status ssh
== Should show: active (running) ==

Test root SSH access:

ssh root@localhost
== Should connect as root ==

2. Configure SSH on Your Local Machine

[edit]

Create or edit ~/.ssh/config on your local machine (where Cursor is installed):

==== On your local machine (not the VPS) ====
nano ~/.ssh/config

Add the following configuration:

Host raspberrypi
    HostName 87.106.61.62
    Port 22223
    User root
    IdentityFile ~/.ssh/id_rsa
    ServerAliveInterval 60
    ServerAliveCountMax 3
    StrictHostKeyChecking no
    UserKnownHostsFile ~/.ssh/known_hosts

Configuration Options:

  • Host raspberrypi: Alias name (use any name you prefer)
  • HostName 87.106.61.62: Your VPS public IP
  • Port 22223: External port for Raspberry Pi forward
  • User root: Username on Raspberry Pi (using root for Cursor)
  • IdentityFile ~/.ssh/id_rsa: Path to your SSH private key
  • ServerAliveInterval 60: Keep connection alive (prevents timeouts)

3. Set Up SSH Key Authentication (Recommended)

[edit]

On your local machine:

Generate SSH key pair (if you don't have one):

[edit]
   ssh-keygen -t ed25519 -C "cursor-raspberrypi"
=== Or use RSA: ssh-keygen -t rsa -b 4096 ===

Copy public key to Raspberry Pi (as root):

[edit]
   ssh-copy-id -p 22223 root@87.106.61.62
=== Or manually: ===
   cat ~/.ssh/id_ed25519.pub | ssh -p 22223 root@87.106.61.62 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Test passwordless connection:

[edit]
   ssh -p 22223 root@87.106.61.62
=== Should connect without password prompt ===

4. Configure Cursor IDE

[edit]

Install Remote SSH Extension (if not already installed):

[edit]
  * Open Cursor
  * Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  * Search for "Remote - SSH" or "Anysphere Remote SSH"
  * Install the extension

Connect to Raspberry Pi:

[edit]
  * Press F1 or Ctrl+Shift+P (Cmd+Shift+P on Mac)
  * Type: Remote-SSH: Connect to Host...
  * Select: raspberrypi (or the Host name from your SSH config)
  * Or enter directly: root@87.106.61.62:22223

First Connection Setup:

[edit]
  * Cursor will install the Cursor server on the Raspberry Pi
  * This may take a few minutes on first connection
  * You'll see a notification: "Installing Cursor Server..."

Select Platform (if prompted):

[edit]
  * Choose: Linuxarm64 or armv7l (depending on your Pi model)

5. Troubleshooting Connection Issues

[edit]

Issue: Connection Timeout

[edit]

Check IONOS Firewall:

  • Verify port 22223 is allowed in IONOS Cloud Panel
  • Check rule priority (lower numbers = higher priority)

Test SSH connection manually:

ssh -v -p 22223 root@87.106.61.62

Check port forward on VPS:

== On VPS ==
sudo ssh-forward list
iptables -t nat -L PREROUTING -n | grep 22223

Issue: "Permission Denied"

[edit]

Verify SSH key is authorized:

===== On Raspberry Pi =====
cat ~/.ssh/authorized_keys
== Should contain your public key ==

Check SSH server logs:

== On Raspberry Pi ==
sudo tail -f /var/log/auth.log
== Attempt connection and watch for errors ==

Verify user permissions:

== On Raspberry Pi ==
ls -la ~/.ssh/
== Should be: drwx------ (700) for .ssh directory ==
== Should be: -rw------- (600) for authorized_keys ==

Issue: Cursor Server Installation Fails

[edit]

Clear Cursor server cache:

===== On Raspberry Pi =====
rm -rf ~/.cursor-server

Check disk space:

== On Raspberry Pi ==
df -h

Check Python/Node.js availability:

== On Raspberry Pi ==
python3 --version
node --version  # If available

Issue: Slow Connection

[edit]

Optimize SSH config: Add to ~/.ssh/config:

Host raspberrypi
    Compression yes
    IPQoS throughput

Use SSH multiplexing:

Host raspberrypi
    ControlMaster auto
    ControlPath ~/.ssh/control-%h-%p-%r
    ControlPersist 10m

6. Verify Complete Setup

[edit]

Test checklist:

  • [ ] SSH port forward is active: sudo ssh-forward list
  • [ ] IONOS firewall allows port 22223
  • [ ] Can SSH manually: ssh -p 22223 root@87.106.61.62
  • [ ] SSH key authentication works (no password prompt)
  • [ ] Cursor can connect via Remote SSH
  • [ ] Cursor server installed on Raspberry Pi
  • [ ] Can open files and use terminal in Cursor

7. Multiple Devices Configuration

[edit]

If you have multiple devices, add separate entries in ~/.ssh/config:

Host synology
    HostName 87.106.61.62
    Port 22222
    User admin
    IdentityFile ~/.ssh/id_rsa

Host raspberrypi
    HostName 87.106.61.62
    Port 22223
    User root
    IdentityFile ~/.ssh/id_rsa

Host device-03
    HostName 87.106.61.62
    Port 22223
    User user
    IdentityFile ~/.ssh/id_rsa

Security Best Practices

[edit]

Note: This guide uses root user for Cursor connections to avoid permission issues. While convenient for development, be aware of security implications.

Use SSH Keys: Always use key-based authentication instead of passwords

[edit]

Disable Password Auth for Root: On Raspberry Pi, edit /etc/ssh/sshd_config:

[edit]
   PermitRootLogin prohibit-password
   PasswordAuthentication no
   PubkeyAuthentication yes
  This allows root login only with SSH keys, not passwords.
  Then restart: sudo systemctl restart ssh

Use Strong Keys: Use ED25519 or RSA 4096-bit keys

[edit]

Limit Access: Consider restricting SSH access to specific IPs if possible

[edit]

Keep Updated: Regularly update Raspberry Pi OS and SSH server

[edit]

Root Access Consideration: Using root avoids permission issues in Cursor but increases security risk. Consider using a dedicated user with sudo if security is a concern.

[edit]

Advanced Configuration

[edit]

SSH Config with Jump Host (Alternative)

[edit]

If you want to connect through the VPS as a jump host:

Host vps
    HostName 87.106.61.62
    User root
    IdentityFile ~/.ssh/id_rsa

Host raspberrypi
    HostName 10.8.0.3
    User root
    ProxyJump vps
    IdentityFile ~/.ssh/id_rsa

Port Forwarding in SSH Config

[edit]

You can also create local port forwards in your SSH config:

Host raspberrypi
    HostName 87.106.61.62
    Port 22223
    User root
    LocalForward 8080 localhost:8080  # Forward local port 8080 to Pi's 8080

Quick Reference

[edit]
Component Value
VPS Public IP 87.106.61.62
Raspberry Pi External Port 22223
Raspberry Pi VPN IP 10.8.0.3
Raspberry Pi SSH Port 22
Default User root

SSH Command:

ssh -p 22223 root@87.106.61.62

Cursor Connection:

  • Host: raspberrypi (from SSH config)
  • Or: root@87.106.61.62:22223
[edit]
  • [SSH Port Forwarding Management](index.md)
  • [OpenVPN Server Configuration](index.md)
  • [Port Forwarding Troubleshooting](port-forwarding-troubleshooting.md)