40 — Cursor.ai acessar SSH Hostinger (Orbitall)¶
Plano operacional para o agente Cursor / Remote-SSH falar com a VPS Hostinger.
Relacionado: 38 — Hostinger passo a passo · 39 — Aprendizado ·scripts/setup-cursor-remote-vps.sh
Objetivo¶
| Uso | Como |
|---|---|
| Cursor UI (editar na VPS) | Extensão Remote-SSH → host lorentz-hostinger |
| Agente Cursor no lab (comandos daqui) | ssh lorentz-hostinger '…' no terminal do workspace |
| Resgate de código | Na VPS: git status / commit / push → no lab: git pull |
Dados da VPS (Orbitall)¶
| Item | Valor |
|---|---|
| Host | 2.25.92.168 (srv1869007.hstgr.cloud) |
| Usuário | root (Hostinger KVM) |
| Alias SSH | lorentz-hostinger |
| Chave privada (lab) | C:\Users\aragu\.ssh\id_ed25519artesdosul |
| Chave pública | id_ed25519artesdosul.pub (comentário típico: aragu@labdev) |
| Workspace remoto | /root/omnichannel/lorentz-vps-stack |
| Supervisor | /root/omnichannel/supervisor |
Plano em 4 fases¶
Fase A0 — Passphrase + ssh-agent (causa comum no lab Windows)¶
A chave id_ed25519artesdosul é OpenSSH com bcrypt/aes256 (protegida por senha).
Scripts com BatchMode=yes não pedem passphrase → Permission denied (publickey) mesmo com a .pub correta na VPS.
Se Set-Service / Start-Service der “Acesso negado”: o serviço Windows ssh-agent está Disabled e só Admin liga. Use A (recomendado) ou B.
A — PowerShell Administrador (uma vez):
# Botão direito no PowerShell → Executar como administrador
Get-Service ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
Depois, no PowerShell normal (Cursor ou usuário):
ssh-add $env:USERPROFILE\.ssh\id_ed25519artesdosul # digite a passphrase
ssh-add -l
ssh lorentz-hostinger "hostname; whoami"
B — Agent do Git no terminal atual (sem Admin):
# Git for Windows — agent só nesta janela
$gitAgent = "C:\Program Files\Git\usr\bin\ssh-agent.exe"
$gitAdd = "C:\Program Files\Git\usr\bin\ssh-add.exe"
$gitSsh = "C:\Program Files\Git\usr\bin\ssh.exe"
$out = & $gitAgent -s
foreach ($line in $out) {
if ($line -match 'SSH_AUTH_SOCK=([^;]+);') { $env:SSH_AUTH_SOCK = $Matches[1] }
if ($line -match 'SSH_AGENT_PID=(\d+);') { $env:SSH_AGENT_PID = $Matches[1] }
}
& $gitAdd $env:USERPROFILE\.ssh\id_ed25519artesdosul
& $gitSsh lorentz-hostinger "hostname; whoami"
C — Sem agent (pede passphrase a cada conexão; não serve para BatchMode/agente Cursor):
Fase A — Chave no hPanel (se ainda falhar após ssh-add)¶
- Copiar a pública:
- hPanel → VPS → SSH keys ou Browser terminal (root):
- Retestar:
ssh lorentz-hostinger "hostname"
Fase B — ~/.ssh/config no lab (já documentado)¶
Arquivo: C:\Users\aragu\.ssh\config
Host lorentz-hostinger
HostName 2.25.92.168
User root
IdentityFile C:/Users/aragu/.ssh/id_ed25519artesdosul
IdentitiesOnly yes
PreferredAuthentications publickey
StrictHostKeyChecking accept-new
ServerAliveInterval 60
ServerAliveCountMax 3
ForwardAgent no
LocalForward 127.0.0.1:9090 127.0.0.1:9090
Refazer após troca de rede / PC:
cd D:\omnichannel\lorentz-vps-stack
.\scripts\setup-cursor-remote.ps1 -EnsureAgent
# com SSH ok (passphrase no agent):
.\scripts\setup-cursor-remote.ps1 -ApplyRemote
Atalho:
Lab IP atual (cabeado 2026-07-31): 177.74.209.19 — liberar TCP 22 no hPanel para esse /32.
Fase C — Preparar a VPS para Remote-SSH (uma vez)¶
No PC, depois do SSH funcionar:
# PowerShell — envia script e executa
Get-Content D:\omnichannel\lorentz-vps-stack\scripts\setup-cursor-remote-vps.sh -Raw |
ssh lorentz-hostinger "bash -s"
Ou (Git Bash / WSL):
ssh -i ~/.ssh/id_ed25519artesdosul root@2.25.92.168 'bash -s' \
< /mnt/d/omnichannel/lorentz-vps-stack/scripts/setup-cursor-remote-vps.sh
O script instala deps (git, curl, …), ajusta sshd (AllowTcpForwarding, keepalives) e lembra de liberar TCP 22 no hPanel.
Fase D — Cursor UI + agente¶
UI Remote-SSH
- Cursor → Command Palette → Remote-SSH: Connect to Host…
- Escolher
lorentz-hostinger - Abrir pasta:
/root/omnichannel/lorentz-vps-stack
(ou/root/omnichannel/supervisorpara o PHP legado)
Agente no lab Windows (workspace supervisor / monorepo):
ssh -o BatchMode=yes lorentz-hostinger @"
cd /root/omnichannel/supervisor
git branch -vv
git log -3 --oneline
git status -sb
"@
Firewall: hPanel → liberar TCP 22 para o IP do lab (ou rede confiável).
Script único de validação (lab → VPS)¶
Salvar/rodar no PowerShell:
# validate-cursor-ssh-hostinger.ps1
$ErrorActionPreference = "Continue"
$hostAlias = "lorentz-hostinger"
$key = "$env:USERPROFILE\.ssh\id_ed25519artesdosul"
Write-Host "==> 1. Chave existe?"
Test-Path $key
Write-Host "==> 2. SSH BatchMode (sem senha)"
ssh -o ConnectTimeout=12 -o BatchMode=yes -o IdentitiesOnly=yes -i $key root@2.25.92.168 "echo SSH_OK; hostname; uptime -p"
Write-Host "==> 3. Alias config"
ssh -o ConnectTimeout=12 -o BatchMode=yes $hostAlias "echo ALIAS_OK; ls /root/omnichannel/supervisor/att_init.php"
Write-Host "==> 4. Git Supervisor na VPS"
ssh -o BatchMode=yes $hostAlias "cd /root/omnichannel/supervisor && git rev-parse --abbrev-ref HEAD && git log -1 --oneline && git status -sb | head -20"
Se o passo 2 falhar com Permission denied (publickey) → voltar à Fase A (não é problema do Cursor).
Resgate de alterações da VPS (após SSH OK)¶
# NA VPS
cd /root/omnichannel/supervisor
git status -sb
git diff --stat
# se houver fix útil não commitado:
git add -A
git commit -m "fix(vps): resgate ajustes Hostinger"
git push origin lorentz-vps
# NO LAB
cd D:\omnichannel\supervisor
# guardar WIP antes (stash ou branch) — ver docs/supervisor-legado-php-lab.md
git fetch origin
git pull --ff-only origin lorentz-vps
Checklist rápido¶
- [ ]
id_ed25519artesdosul.pubem/root/.ssh/authorized_keysna Hostinger - [ ]
ssh lorentz-hostingerfunciona no PowerShell (sem senha) - [ ] hPanel: TCP 22 liberado para o IP atual do lab (
177.74.209.19/32se cabeado) - [ ]
.\scripts\setup-cursor-remote.ps1 -EnsureAgent(chave no agent) - [ ]
setup-cursor-remote-vps.shjá rodou uma vez (-ApplyRemote) - [ ] Cursor Remote-SSH conecta em
lorentz-hostinger - [ ] Agente consegue
ssh -o BatchMode=yes lorentz-hostinger "hostname"
Referências¶
| Arquivo | Função |
|---|---|
scripts/setup-cursor-remote-vps.sh |
Prepara pacotes + sshd na VPS |
docs/38-vps-hostinger-passo-a-passo.md §2.2 |
Cursor Remote-SSH |
docs/39-diagnostico-err-cert-orbitall-hostinger.md |
IP, chave, incidentes |
../../docs/supervisor-legado-php-lab.md |
Lab + resgate f6e6971 |