Remote Access - VS Code

The Computer Science and Data Science departments offers two methods for utilizing VS Code remotely with your CS Linux filesystem access. Please read the following FAQ completely, and let Chris Wieringa, CS Lab Manager, cwieri39@calvin.edu know if you have further questions.


Option 1: Remote - Tunnels

VS Code has added an extension called 'Remote - Tunnels', allowing VS Code to work remotely on a pre-configured workstation. This allows you to utilize a pre-configured environment for your coding! Computer Science offers a server "codetunnel.cs.calvin.edu" that can be utilized to setup a remote VS tunnel to allow development in a lab-like environment while utilizing VS Code on your own machine. Any terminals opened within VS Code after connecting to the remote tunnel will act just like they do on a lab-machine.

There are several one-time setup steps that you will need to follow to configure this on your own machine. After initial setup, you will have a smaller set of steps to utilize this in the future.

One-time Setup
  1. You must have a GitHub account to use this service. If you do not have a Github account, you must create one first. https://github.com
  2. Install VS Code on your own computer. *** Note: you do NOT need to install any compilers, WSL, etc when using this method! ***
  3. Install the Remote - Tunnels VS Code extension into your VS Code.
  4. Connect to the codetunnel hosting server:
    • Log into Remote Lab Access Guacamole, then select "Calvin CS Labs" -> "Linux - VSCode Tunnel".

      (Alternately, you can SSH to cs-ssh and then to codetunnel.cs.calvin.edu . See this for more information.)
    • Run the command:
      code tunnel --accept-server-license-terms

      You will be prompted to log into GitHub to complete the setup. Note the device code that is given.
    • Grant access by clicking https://github.com/login/device. Use the code that is specified, and "Authorize Visual-Studio-Code"..
    • After authenticating, your codetunnel screen output should have changed. You will be provided a tunnel name that is randomly generated. (Example: recursing-duckbill) Make a note of this name.
  5. Continue in the VS Code Usage section.
Normal Startup
  1. Connect to the codetunnel hosting server:
    • Log into Remote Lab Access Guacamole, then select "Calvin CS Labs" -> "Linux - VSCode Tunnel".

      (Alternately, you can SSH to cs-ssh and then to codetunnel.cs.calvin.edu . See this for more information.)
    • Run the command:
      code tunnel

      Note the provided tunnel name that is randomly generated. (Example: recursing-duckbill)
  2. Continue in the VS Code Usage section.
VS Code Usage

After starting a code tunnel server, you can use these steps to connect in your VS Code instance.

  1. Open VS Code, and open the Command Palette (F1)
  2. Search for "Connect to Tunnel" and click it:
  3. You may be prompted to log into GitHub if you aren't already on this computer.
  4. Select from the list of tunnels, matching the name of the one that was assigned --- probably "codetunnel".
  5. Be patient as the remote connect establishes. This step may take 1-3 minutes. When things are ready, you will notice the remote indicator in the lower left corner now shows the name of the tunnel.
  6. Done!

When you are done with your session, close your tunnel in VS Code and log out of Guacamole / codetunnel. Ctrl + C can be used to close your code server.

(Some images taken from https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server.)


Option 2: SSHFS

VS Code has an extension called 'SSHFS', allowing VS Code to remotely mount your CS Linux home directory and directly edit files on the remote file system. This still requires that you have all compilers, libraries, etc that you need for programming installed on your local machine.

One-time Setup

This process requires that you have correctly setup a private/public SSH keypair and installed it onto the cs-ssh server. See Remote Access - Linux for instructions for that PRIOR to configuring SSHFS.

  1. Install VS Code on your own computer. *** Note: you must install any compilers, WSL, programming launchages, etc that you will need when using this method! ***
  2. Install the VS Code extension SSHFS. (See https://marketplace.visualstudio.com/items?itemName=Kelvin.vscode-sshfs for more information and configuration options.)
  3. Inside VS Code, look at the Extensions installed on the left-side of your screen, and locate the SSHFS extension:
  4. Add a new configuration, by clicking the + icon (highlighted below)
  5. Name your configuration: cs-ssh
    and Save it!
  6. Fill out the following values:
    • Host: cs-ssh.cs.calvin.edu
    • Port: 22
    • Root: /home/<username> (fill in with your username! Example: /home/jtw1 )
    • Private key: <full filesystem path to your private SSH key!> (fill in as appropriate!)
    • Passphrase: <fill in if appropriate> (if using a passphrase on your private key)
    • New file mode:
      Owner: READ WRITE (unchecked)
      Group: READ WRITE (unchecked)
      Other: (none - all unchecked)
  7. Done!
Normal Usage

Your configuration should be persistent. Clicking the SSHFS extension will allow you to either add the Remote Workspace folder (highlighted in blue) and browse and edit your files directly, or to execute a remote SSH terminal (highlighted in orange).

Note that the cs-ssh terminal will not have full access to compilers, languages or libraries. If you need this, see option 1 above using 'Remote - Tunnels'.