VS Code Remote-SSH for HPC
Welcome!
This workshop teaches you how to use Microsoft VS Code with the Remote-SSH extension to develop and run code on the Pomona College Sagehen HPC cluster. VS Code Remote-SSH provides a full integrated development environment (IDE) experience while working on remote systems, combining the power of a modern editor with direct access to your HPC cluster.
Why take this workshop?
After this workshop, you will be able to:
- Install and configure VS Code with the Remote-SSH extension
- Connect securely to the Sagehen HPC cluster using DUO MFA
- Edit remote files using VS Code’s powerful editor features
- Use VS Code’s integrated terminal to run SLURM commands and monitor jobs
- Install and use extensions for Python, R, Jupyter, and Git workflows
- Understand when VS Code Remote-SSH is the right tool for HPC work
What you’ll need
- Your own laptop (Windows, Mac, or Linux)
- A Pomona College HPC account on Sagehen HPC cluster
- VS Code installed on your local machine
- SSH access credentials for the cluster
- DUO MFA enabled on your account (required by Sagehen HPC)
- 30-45 minutes for the full workshop
Workshop structure
This workshop is organized as follows:
| Episode | Time | Topic |
|---|---|---|
| 1 | 15 min + 5 ex | Why VS Code Remote-SSH? Comparison with alternatives |
| 2 | 20 min + 10 ex | Installation and configuration on all platforms |
| 3 | 25 min + 15 ex | Connecting to Sagehen with DUO authentication |
| 4 | 20 min + 10 ex | Editing files, creating projects, file management |
| 5 | 20 min + 15 ex | Using the integrated terminal and SLURM commands |
| 6 | 25 min + 10 ex | Adding extensions and customizing your environment |
Total teaching time: ~2 hours (plus exercises)
Getting help
If you encounter issues during the workshop:
- Email: its-hpc@pomona.edu
- Slack: #hpc-help (Pomona CS Slack)
- Office hours: See ITS-HPC website for Andrew Wilson’s availability
- Known issues: See the reference section for common problems and solutions
Before you begin
Please complete the following:
- Ensure you have an HPC account: Log into Sagehen HPC cluster documentation to verify your account status
- Enable DUO MFA: If you haven’t already, register your device at duo.pomona.edu
-
Test SSH access: From your terminal, try:
ssh <myusername>@sagehen.hpc.pomona.edu(this will confirm your access works) - Download VS Code: From code.visualstudio.com
Ready to get started? Let’s dive into why VS Code is such a powerful tool for HPC work!
Questions or suggestions? Please contact its-hpc@pomona.edu or open an issue on our GitHub repository.
Acknowledgments
Developed by Andrew Wilson, Director of Research Computing and Digital Scholarship at Pomona College, with Andrei Motchenko, who tested, edited and produced screenshots for the workshop series.
Pre-Workshop Requirements
Before attending the workshop, please complete the following steps to ensure everything is working properly.
1. Install VS Code
VS Code is the IDE we’ll use to connect to Sagehen.
- Visit code.visualstudio.com
- Click “Download for Windows”
- Run the installer
- Follow the installation wizard (default options are fine)
- Launch VS Code when installation completes
- Visit code.visualstudio.com
- Click “Download for Mac”
- Extract the downloaded zip file
- Drag “Visual Studio Code.app” to your Applications folder
- Open Applications and double-click VS Code to launch it
2. Install the Remote-SSH Extension
Once VS Code is installed, add the Remote-SSH extension to enable HPC cluster connections.
- Open VS Code
- Click the Extensions icon (left sidebar, looks like four squares)
- Search for “Remote - SSH”
- Find the extension by Microsoft (should be first result)
- Click “Install”
- Wait for installation to complete
This extension allows VS Code to connect to remote machines via SSH.
3. Generate or Verify SSH Key Pair
SSH keys enable secure passwordless authentication (though DUO MFA is still required).
On Windows (PowerShell):
POWERSHELL
ssh-keygen -t ed25519 -f $ENV:USERPROFILE\.ssh\id_sagehen
# When prompted for passphrase, press Enter (or set one if desired)
On macOS/Linux:
BASH
ssh-keygen -t ed25519 -f ~/.ssh/id_sagehen
# When prompted for passphrase, press Enter (or set one if desired)
This creates two files: - id_sagehen (private key - keep
secret!) - id_sagehen.pub (public key - copy to server)
4. Test SSH Connection to Sagehen HPC
Before the workshop, verify you can log in to the Sagehen HPC cluster.
You will be prompted for: 1. Your Pomona password 2. DUO MFA authentication (choose “send push” or enter code)
Once you connect, you should see the Sagehen prompt. Type
exit to disconnect.
If you can’t connect: - Verify your username and password - Confirm your DUO is registered at https://duo.pomona.edu - Contact its-hpc@pomona.edu for help
5. Create or Update SSH Config File
An SSH config file simplifies connecting to Sagehen. Create one on your local machine.
Create the file (if it doesn’t exist):
POWERSHELL
# Create .ssh directory if needed
New-Item -ItemType Directory -Force -Path $ENV:USERPROFILE\.ssh
# Open config in notepad
notepad $ENV:USERPROFILE\.ssh\config
Add this content (replace your_username with your Pomona
username):
Host sagehen
HostName sagehen.hpc.pomona.edu
User your_username
IdentityFile ~/.ssh/id_sagehen
ServerAliveInterval 300
ServerAliveCountMax 2
Save the file (Ctrl+S).
Open a terminal and create/edit the config:
Add this content (replace your_username with your Pomona
username):
Host sagehen
HostName sagehen.hpc.pomona.edu
User your_username
IdentityFile ~/.ssh/id_sagehen
ServerAliveInterval 300
ServerAliveCountMax 2
Save: Ctrl+O, Enter, Ctrl+X
Set permissions:
6. Test SSH Connection with Config
Now test connecting using the simplified alias:
You should be able to connect with just one command. Complete the DUO authentication.
7. Optional: Copy SSH Public Key to Server
This step is optional but enables faster authentication (DUO MFA still required).
On Windows, if ssh-copy-id doesn’t work, use
PowerShell:
8. Copy Files to Sagehen HPC (Optional)
You may need to copy files between your computer and Sagehen. Test with a sample file:
9. Verify OnDemand Access (Optional)
Sagehen also provides a web-based interface. You can optionally test this at:
https://ondemand.hpc.pomona.edu/
Log in with your Pomona credentials + DUO.
This is useful for file browsing and running interactive jobs, though we’ll focus on VS Code in this workshop.
Troubleshooting Pre-Workshop Issues
“SSH: Connection refused” - Verify hostname:
sagehen.hpc.pomona.edu - Check firewall isn’t blocking port
22 - Ensure VPN is connected if required
“Authentication failed” - Double-check username and password - Verify DUO is registered and your phone is nearby - Try request a call instead of entering code
“Remote-SSH extension not appearing” - Restart VS Code (File → Exit, then reopen) - Try reinstalling the extension
“VS Code can’t find SSH key” - Verify key path in
~/.ssh/config is correct - Check key file exists:
ls ~/.ssh/id_sagehen - Check file permissions:
chmod 600 ~/.ssh/id_sagehen
Getting Help Before Workshop
If you have trouble with any step:
- Email: its-hpc@pomona.edu
- Subject line: “Help with VS Code + Sagehen setup”
-
Include:
- Exact error message (copy-paste)
- Your operating system
- Which step you’re stuck on
- What you’ve already tried