Skip to content

Using VS Code remote ssh settings

To reduce CPU usage and traffic on the log-in node shell-hpc, we have set up a VM to handle VS Code so that those processes are running on that machine.

We support the Remote - SSH extension for this purpose.

Extensions

If you have a local set of extensions, you'll have to re-install your extensions on the remote machine, so don't be dismayed if they are initially missing.

Quickstart guide

If you're familiar with editing your ssh config file as explained in the connecting guide, then getting your vs code connection will be relatively simple. It should look like this when you're done:

~/.ssh/config
Host shell
    HostName shell.hpc.oregonstate.edu
    User ONIDUSER
    ControlMaster auto
    ControlPath ~/.ssh/sockets/%r@%h-%p
    ControlPersist 600
    TCPKeepAlive no
    ServerAliveInterval 30

Host vscode
    HostName vs-gateway.hpc.oregonstate.edu
    User ONIDUSER
    PubkeyAcceptedKeyTypes +ssh-rsa
    ProxyJump shell
    TCPKeepAlive no
    ServerAliveInterval 30

Tip

Make sure to run mkdir -p ~/.ssh/sockets first so the directory that keeps the sockets open is present. Also, replace your onid username for ONIDUSER.

Note

We previously maintained separate instructions for connecting through the VPN or on campus, but those instructions are no longer necessary.

Step-by-step tutorial

  1. Install the Remote - SSH
    • i.e. run ext install ms-vscode-remote.remote-ssh in the quick open panel (ctrl+p)
  2. Restart extensions
    • i.e. ctrl+shift+x -> Click restart extensions
    • OR open command pane ctrl+shift+p -> Restart extension host; ctrl+shift+p -> Extensions: Refresh
  3. Open the command pane ctrl+shift+p -> Open SSH Configuration File...
    • I had to choose /home/$USERNAME/.ssh/config
    • copy/paste the ~/.ssh/config file contents from above into the file
    • Save the file
  4. Test it out by connecting to host i.e.
    • ctrl+shift+p -> Connect to host -> vscode
    • Alternatively, click on the Open a remote window button in the bottom left corner, then Connect to host or Connect Current Window to Host, then vscode

See this graphic for more info:

VS Code Remote - SSH
Enable and use the Remote - SSH connection method

Submitting jobs from vscode machine

Slurm is enabled on the vs-gateway machine so that you can submit jobs from the node. The terminal window should work as expected. You can duplicate terminals and use salloc to run interactive jobs as well.

Feedback

Please let us know if you run into problems using this method so that we can help you troubleshoot your connection issues.