How to SSH to the Grid in Visual Studio Code

Follow these steps to properly set up SSH access to the Grid in Visual Studio Code on Windows or MacOS. If you SSH to the Grid in VSCode without following these steps, your VSCode connection won't be set up properly. This will cause VSCode to use resources on the login node Warrior, even if you start an interactive job in VSCode. Any computationally intensive processes on Warrior are prohibited, and you will be warned if you're connecting this way. If you continue to run VSCode without following these steps, your processes on Warrior will be killed.

1. Generate an ED25519 SSH key

  • OOn the Grid, generate an ED25519 SSH key by running: ssh-keygen -t ed25519
  • This will create a key pair in ~/.ssh/

2. Copy your Private Key to your local system

a. From Warrior:

  • Locate your private SSH key: ~/.ssh/id_ed25519

b. To your local system:

  • Copy the key file to the following equivalent location, renaming zz9992 with your own AccessID: %USERPROFILE%\.ssh\id_ed25519_zz9992

3. Generate and Set Up Your SSH Config File

a. On Warrior:

  • Run this command to generate an SSH configuration file: /wsu/apps/scripts/generate_vscode_ssh_jump_config.sh
  • This will create a file named vscode_ssh_config.

b. To your local system:

  • Copy the contents of the generated file and save it as your SSH config file: %USERPROFILE%\.ssh\config

4. Secure the .ssh Directory

  • For Windows: To protect your SSH directory, disable inherited permissions by running this command in Windows Command Prompt: icacls %USERPROFILE%\.ssh /inheritance:d
  • For MacOS, use the chmod command to set permissions:
    • This command sets it so you (owner) can open, modify, and list files in .ssh. No one else can access the folder at all: chmod 700 ~/.ssh
    • This command sets it so only you can read or edit the private key. No one else can read or modify it - renaming zz9992 with your own AccessID: chmod 600 ~/.ssh/id_ed25519_zz9992

5. Start a Slurm Job

  • Before running VSCode on the Grid, start a Slurm job. Check the name of the node your job is on by using this command and checking NODELIST: qme

6. Test Your SSH Connection

a. Connect to Warrior

  • Open Windows Command Prompt and type: ssh warrior
  • If successful, you should be logged into Warrior.

b. Connect to a Slurm Job Node

  • To connect to a compute node where your Slurm job is running, replace sfx1 with the correct node name: ssh sfx1

7. Connect to the Grid Using VSCode

  • Once your SSH setup is complete, you can run VSCode remotely on the Grid.
  1. Open VSCode on Windows.
  2. Press Ctrl-Shift-P.
  3. Type ssh in the command palette.
  4. Select "Connect to Host...".
  5. Enter the node name of your Slurm job.

Now, you can use VSCode to edit files and run code directly on the Grid!