Cursor SSH:Setup: Difference between revisions
Added troubleshooting guide: Cursor IDE SSH Connection Setup for Raspberry Pi |
Major update - troubleshooting guide: Cursor IDE SSH Connection Setup for Raspberry Pi (58 sections) |
||
| Line 1: | Line 1: | ||
This guide explains how to configure Cursor IDE to connect to a Raspberry Pi through the VPS SSH port forward. | This guide explains how to configure Cursor IDE to connect to a Raspberry Pi through the VPS SSH port forward. | ||
| Line 13: | Line 11: | ||
== Prerequisites == | == Prerequisites == | ||
= ✅ '''SSH Port Forward Configured''' (Already done) = | === ✅ '''SSH Port Forward Configured''' (Already done) === | ||
* Port forward: <code>22223</code> → <code>10.8.0.3:22</code> | * Port forward: <code>22223</code> → <code>10.8.0.3:22</code> | ||
* Verify: <code>sudo ssh-forward list</code> | * Verify: <code>sudo ssh-forward list</code> | ||
= ✅ '''IONOS Firewall Rule''' (Required) = | == ✅ '''IONOS Firewall Rule''' (Required) == | ||
* Port <code>22223</code> must be allowed in IONOS Cloud Panel | * Port <code>22223</code> must be allowed in IONOS Cloud Panel | ||
* See: [SSH Port Forwarding Guide](Ssh-Port-Forwarding.md) | * See: [SSH Port Forwarding Guide](Ssh-Port-Forwarding.md) | ||
= '''Raspberry Pi Requirements''': = | == '''Raspberry Pi Requirements''': == | ||
* SSH server enabled | * SSH server enabled | ||
| Line 43: | Line 41: | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
sudo raspi-config | sudo raspi-config | ||
= Navigate to: Interfacing Options → SSH → Enable = | == Navigate to: Interfacing Options → SSH → Enable == | ||
</pre> | </pre> | ||
'''Enable root SSH access (on Raspberry Pi):''' | '''Enable root SSH access (on Raspberry Pi):''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= Set root password (if not already set) = | == Set root password (if not already set) == | ||
r | r | ||
= Enable root login via SSH = | == Enable root login via SSH == | ||
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
= Or if using password auth: = | == Or if using password auth: == | ||
sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config | sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
= Restart SSH service = | == Restart SSH service == | ||
sudo systemctl restart ssh | sudo systemctl restart ssh | ||
</pre> | </pre> | ||
| Line 63: | Line 61: | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
sudo systemctl status ssh | sudo systemctl status ssh | ||
= Should show: active (running) = | == Should show: active (running) == | ||
</pre> | </pre> | ||
| Line 69: | Line 67: | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
ssh root@localhost | ssh root@localhost | ||
= Should connect as root = | == Should connect as root == | ||
</pre> | </pre> | ||
| Line 77: | Line 75: | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On your local machine (not the VPS) = | ==== On your local machine (not the VPS) ==== | ||
nano ~/.ssh/config | nano ~/.ssh/config | ||
</pre> | </pre> | ||
| Line 112: | Line 110: | ||
'''On your local machine:''' | '''On your local machine:''' | ||
= '''Generate SSH key pair''' (if you don't have one): = | ==== '''Generate SSH key pair''' (if you don't have one): ==== | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
ssh-keygen -t ed25519 -C "cursor-raspberrypi" | ssh-keygen -t ed25519 -C "cursor-raspberrypi" | ||
=== Or use RSA: ssh-keygen -t rsa -b 4096 === | |||
</pre> | </pre> | ||
= '''Copy public key to Raspberry Pi (as root):''' = | == '''Copy public key to Raspberry Pi (as root):''' == | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
ssh-copy-id -p 22223 root@87.106.61.62 | 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" | 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" | ||
</pre> | </pre> | ||
= '''Test passwordless connection:''' = | == '''Test passwordless connection:''' == | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
ssh -p 22223 root@87.106.61.62 | ssh -p 22223 root@87.106.61.62 | ||
=== Should connect without password prompt === | |||
</pre> | </pre> | ||
=== 4. Configure Cursor IDE === | === 4. Configure Cursor IDE === | ||
= '''Install Remote SSH Extension''' (if not already installed): = | ==== '''Install Remote SSH Extension''' (if not already installed): ==== | ||
* Open Cursor | * Open Cursor | ||
| Line 142: | Line 140: | ||
* Install the extension | * Install the extension | ||
= '''Connect to Raspberry Pi''': = | == '''Connect to Raspberry Pi''': == | ||
* Press <code>F1</code> or <code>Ctrl+Shift+P</code> (Cmd+Shift+P on Mac) | * Press <code>F1</code> or <code>Ctrl+Shift+P</code> (Cmd+Shift+P on Mac) | ||
| Line 151: | Line 149: | ||
* Or enter directly: <code>root@87.106.61.62:22223</code> | * Or enter directly: <code>root@87.106.61.62:22223</code> | ||
= '''First Connection Setup''': = | == '''First Connection Setup''': == | ||
* Cursor will install the Cursor server on the Raspberry Pi | * Cursor will install the Cursor server on the Raspberry Pi | ||
| Line 158: | Line 156: | ||
* You'll see a notification: "Installing Cursor Server..." | * You'll see a notification: "Installing Cursor Server..." | ||
= '''Select Platform''' (if prompted): = | == '''Select Platform''' (if prompted): == | ||
* Choose: <code>Linux</code> → <code>arm64</code> or <code>armv7l</code> (depending on your Pi model) | * Choose: <code>Linux</code> → <code>arm64</code> or <code>armv7l</code> (depending on your Pi model) | ||
| Line 177: | Line 175: | ||
'''Check port forward on VPS:''' | '''Check port forward on VPS:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On VPS = | == On VPS == | ||
sudo ssh-forward list | sudo ssh-forward list | ||
iptables -t nat -L PREROUTING -n | grep 22223 | iptables -t nat -L PREROUTING -n | grep 22223 | ||
| Line 186: | Line 184: | ||
'''Verify SSH key is authorized:''' | '''Verify SSH key is authorized:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | ===== On Raspberry Pi ===== | ||
cat ~/.ssh/authorized_keys | cat ~/.ssh/authorized_keys | ||
= Should contain your public key = | == Should contain your public key == | ||
</pre> | </pre> | ||
'''Check SSH server logs:''' | '''Check SSH server logs:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | == On Raspberry Pi == | ||
sudo tail -f /var/log/auth.log | sudo tail -f /var/log/auth.log | ||
= Attempt connection and watch for errors = | == Attempt connection and watch for errors == | ||
</pre> | </pre> | ||
'''Verify user permissions:''' | '''Verify user permissions:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | == On Raspberry Pi == | ||
ls -la ~/.ssh/ | ls -la ~/.ssh/ | ||
= Should be: drwx------ (700) for .ssh directory = | == Should be: drwx------ (700) for .ssh directory == | ||
= Should be: -rw------- (600) for authorized_keys = | == Should be: -rw------- (600) for authorized_keys == | ||
</pre> | </pre> | ||
| Line 210: | Line 208: | ||
'''Clear Cursor server cache:''' | '''Clear Cursor server cache:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | ===== On Raspberry Pi ===== | ||
rm -rf ~/.cursor-server | rm -rf ~/.cursor-server | ||
</pre> | </pre> | ||
| Line 216: | Line 214: | ||
'''Check disk space:''' | '''Check disk space:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | == On Raspberry Pi == | ||
df -h | df -h | ||
</pre> | </pre> | ||
| Line 222: | Line 220: | ||
'''Check Python/Node.js availability:''' | '''Check Python/Node.js availability:''' | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
= On Raspberry Pi = | == On Raspberry Pi == | ||
python3 --version | python3 --version | ||
node --version # If available | node --version # If available | ||
| Line 291: | Line 289: | ||
'''Note''': This guide uses root user for Cursor connections to avoid permission issues. While convenient for development, be aware of security implications. | '''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 = | === '''Use SSH Keys''': Always use key-based authentication instead of passwords === | ||
= '''Disable Password Auth for Root''': On Raspberry Pi, edit <code>/etc/ssh/sshd_config</code>: = | == '''Disable Password Auth for Root''': On Raspberry Pi, edit <code>/etc/ssh/sshd_config</code>: == | ||
<pre> | <pre> | ||
PermitRootLogin prohibit-password | PermitRootLogin prohibit-password | ||
| Line 301: | Line 299: | ||
Then restart: <code>sudo systemctl restart ssh</code> | Then restart: <code>sudo systemctl restart ssh</code> | ||
= '''Use Strong Keys''': Use ED25519 or RSA 4096-bit keys = | == '''Use Strong Keys''': Use ED25519 or RSA 4096-bit keys == | ||
= '''Limit Access''': Consider restricting SSH access to specific IPs if possible = | == '''Limit Access''': Consider restricting SSH access to specific IPs if possible == | ||
= '''Keep Updated''': Regularly update Raspberry Pi OS and SSH server = | == '''Keep Updated''': Regularly update Raspberry Pi OS and SSH server == | ||
= '''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. = | == '''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. == | ||
== Advanced Configuration == | == Advanced Configuration == | ||
Latest revision as of 13:44, 1 January 2026
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:22223→10.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]* PressF1orCtrl+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:Linux→arm64orarmv7l(depending on your Pi model)
5. Troubleshooting Connection Issues
[edit]Issue: Connection Timeout
[edit]Check IONOS Firewall:
- Verify port
22223is 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
Related Documentation
[edit]- [SSH Port Forwarding Management](index.md)
- [OpenVPN Server Configuration](index.md)
- [Port Forwarding Troubleshooting](port-forwarding-troubleshooting.md)