Connecting Cursor to Offline HPC Compute Nodes via User-Space SSHD
Background
Connecting modern IDEs like Cursor to HPC compute nodes can be highly frustrating. Many SLURM clusters enforce strict security policies: they block inbound internet access, disable outbound internet on compute nodes (breaking tools like Ngrok or Pinggy), and restrict standard SSH access via GSSAPI (Kerberos) or PAM, effectively disabling standard SSH key authentication.
To bypass these restrictions without root privileges, we can run a User-Space SSH Daemon (SSHD) directly on the compute node. By binding it to a high port (e.g., 22222) and running it under your own user account, it bypasses system-level Kerberos/PAM restrictions and allows seamless connections via your local SSH keys.
Step 1: Establish Internal Trust
Because you will be jumping from the login node to the compute node, the cluster needs to trust its own internal connections.
Log in to your HPC login node and generate an internal SSH key. Then, add it to your own authorized keys list:
1 | # Generate an internal ed25519 key (Press Enter to accept defaults and empty passphrase) |
Note: You also need to ensure your local computer’s public key (e.g., your Windows/Mac id_rsa.pub) is pasted into this ~/.ssh/authorized_keys file.
Step 2: Create the SLURM Script
Next, create a SLURM batch script that will dynamically generate an SSH configuration file and launch the daemon on the allocated compute node.
Create a file named run_custom_sshd.slurm in your home directory:
1 | cat << 'EOF' > ~/run_custom_sshd.slurm |
Step 3: Submit the Job
Submit the script to the SLURM queue:
1 | sbatch ~/run_custom_sshd.slurm |
Once the job is running, check the output log (e.g., cat cursor_sshd_12345.log) to verify the daemon has started and to note the name of the allocated compute node (e.g., d4042).
Step 4: Configure Local SSH
On your local machine (Windows/Mac), open your SSH configuration file (~/.ssh/config). Set up a ProxyJump so your local machine routes traffic through the login node directly into your custom port on the compute node.
1 | # 1. Define the Login Node |
Step 5: Connect via Cursor
Open Cursor, navigate to the Remote-SSH extension, and select hpc-compute to connect.
You now have a persistent, highly stable connection for your 30-day interactive jobs!