Setting Up SSH Config

Last updated on 2026-08-27 | Edit this page

Estimated time: 20 minutes

Overview

Questions

  • What SSH configuration do I need for Sagehen HPC?
  • How do I set up SSH keys for passwordless authentication?

Objectives

  • Configure ~/.ssh/config with proper Sagehen credentials
  • Set correct file permissions on SSH files
  • Optionally generate SSH keys (Ed25519 recommended)
  • Verify SSH connectivity from the terminal

Create or Edit ~/.ssh/config


VS Code Remote-SSH uses your system’s SSH configuration to connect. You need an entry for Sagehen in ~/.ssh/config.

On Windows (PowerShell):

POWERSHELL

New-Item -ItemType Directory -Force -Path $HOME\.ssh | Out-Null
notepad $HOME\.ssh\config

On Mac/Linux (Terminal):

BASH

mkdir -p ~/.ssh && chmod 700 ~/.ssh
nano ~/.ssh/config

Add the Sagehen HPC Entry

Callout

SSH Configuration for Sagehen HPC

Add this to your ~/.ssh/config (replace <myusername> with your Pomona username):

Host sagehen
    HostName sagehen.hpc.pomona.edu
    User username
    ServerAliveInterval 300
    ServerAliveCountMax 2
Setting Purpose
Host sagehen Friendly name for the connection
HostName sagehen.hpc.pomona.edu Actual cluster address
User username Your Pomona username
ServerAliveInterval 300 Keep connection alive every 300 seconds
ServerAliveCountMax 2 Disconnect after 2 unanswered keepalives

Set File Permissions (Mac/Linux)

BASH

chmod 600 ~/.ssh/config
chmod 700 ~/.ssh

Optional: Generate SSH Key


For passwordless connections (DUO still applies), generate an SSH key. Ed25519 is recommended; RSA-4096 is also acceptable.

Generate a key:

BASH

ssh-keygen -t ed25519 -C "your-email@pomona.edu"

Press Enter for default location. You may set a passphrase or leave blank.

Copy to Sagehen (Mac/Linux):

BASH

ssh-copy-id -i ~/.ssh/id_ed25519 sagehen

Copy to Sagehen (Windows PowerShell):

POWERSHELL

Get-Content $HOME\.ssh\id_ed25519.pub | Set-Clipboard
# SSH into Sagehen manually, then:
# mkdir -p ~/.ssh && echo "PASTE_KEY_HERE" >> ~/.ssh/authorized_keys
# chmod 600 ~/.ssh/authorized_keys

Test Your SSH Connection


Before using VS Code Remote-SSH, verify from your terminal:

BASH

ssh sagehen

Expected sequence:

  1. Password prompt: <myusername>@sagehen.hpc.pomona.edu's password:
  2. Enter your Pomona password
  3. DUO prompt appears
  4. Complete DUO authentication
  5. You see: [<myusername>@sagehen-login-1 ~]$

Type exit to disconnect.

If this fails: Check your username in ~/.ssh/config, verify Pomona credentials and DUO registration, and contact if needed.

Challenge

Challenge: Verify SSH Configuration

  1. Open ~/.ssh/config and check the sagehen entry
  2. Run ssh -G sagehen to display your effective SSH configuration
  3. Run ssh sagehen and complete DUO authentication
  4. Once connected, run uname -a and whoami, then exit

ssh -G sagehen should show:

hostname sagehen.hpc.pomona.edu
user yourname
serveraliveinterval 300
serveralivecountmax 2
A PowerShell window where ssh -G sagehen is piped to Select-String to filter key settings. The output shows the username, hostname sagehen.hpc.pomona.edu, serveralivecountmax 2, and serveraliveinterval 300.
Verifying the effective config on Windows: ssh -G sagehen filtered through Select-String.

After connecting, uname -a shows a Linux kernel version and whoami shows your Pomona username. If whoami returns the wrong name, fix the User line in ~/.ssh/config. If the connection hangs at the DUO two-factor login prompt, verify DUO registration.

Key Points
  • Configure ~/.ssh/config with a Host sagehen entry and your Pomona username
  • Set proper file permissions (600 for config, 700 for .ssh directory)
  • SSH keys (Ed25519 recommended) are optional but convenient for frequent users
  • Always test ssh sagehen from a terminal before using VS Code Remote-SSH