SSH Connection & Dev Environment Guide

Orientation: What You’re Setting Up and Why

What is SSH (in plain language)?

SSH (Secure Shell) lets you control another computer (the server) from your laptop (the local machine) over an encrypted connection. In this course, you will log into babylon.eecs.oregonstate.edu to run tools and code that live on the server.

Keys vs Passwords (why we use SSH keys)

Passwords are easy to mistype and insecure to reuse. SSH keys are like ID cards: you generate a keypair (private + public) on your laptop, copy the public key to the server, and keep the private key safe locally. After setup, you log in without typing your password each time.

Editor choice (why VS Code Remote SSH)

VS Code Remote SSH lets you open, edit, and run files stored on the server while using a familiar editor on your laptop.

Environments (why Conda)

Different projects need different Python versions and libraries. Conda (Miniforge) manages that cleanly and avoids many dependency hassles.


Windows Preparation (Local Machine)

Install WSL (Ubuntu)

Install WSL (PowerShell as Administrator)

bash
wsl --install -d Ubuntu

Check Windows OpenSSH Client (optional)

Verify or Install OpenSSH Client (PowerShell)

bash
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Install VS Code & Remote SSH (Local Machine)

Why this matters: You'll edit server files using your local VS Code. The Remote SSH extension installs a helper on the server automatically.

Install VS Code + Remote SSH

bash
# 1) Install Visual Studio Code
# 2) Open Extensions (Ctrl+Shift+X) → install "Remote - SSH"

Create SSH Keys (Local Machine)

Where the keys live: ~/.ssh (hidden folder). The private key (e.g., id_ed25519) must remain secret; the public key (id_ed25519.pub) is safe to share with servers.

Generate SSH Key (Linux/macOS/WSL)

bash
ssh-keygen -t ed25519 -C "onid@oregonstate.edu"

Optional: Use an SSH agent (avoids re-typing passphrase)

Start agent & add key (Linux/macOS/WSL)

bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Start agent & add key (Windows PowerShell)

bash
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
ssh-add $env:USERPROFILE\\.ssh\\id_ed25519

Copy Your Public Key to the Server

What this does: places your public key in ~/.ssh/authorized_keys on the server so it trusts your key.

Copy key (Linux/macOS/WSL)

bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub onid@babylon.eecs.oregonstate.edu

Copy key (Windows PowerShell fallback)

bash
type $env:USERPROFILE\\.ssh\\id_ed25519.pub | ssh onid@babylon.eecs.oregonstate.edu "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Fix server-side permissions (run after login)

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Test Your SSH Login

Goal: log in without typing your ONID password.

Test connection (Local Machine)

bash
ssh onid@babylon.eecs.oregonstate.edu

Use VS Code Remote SSH

Once keys work, VS Code can open your server folders for editing, terminals, and debugging.

Connect via VS Code (Local Machine)

bash
F1  Remote-SSH: Connect to Host  onid@babylon.eecs.oregonstate.edu
Select remote OS: Linux

Make connection easier with SSH config (recommended)

Create or edit ~/.ssh/config on your local machine:

Basic host entry (Local Machine)

bash
Host babylon
  HostName babylon.eecs.oregonstate.edu
  User onid
  IdentityFile ~/.ssh/id_ed25519
  ServerAliveInterval 120
  ServerAliveCountMax 300

Permissions for SSH config

bash
chmod 600 ~/.ssh/config

Now you can run ssh babylon, or pick babylon directly in VS Code.

Select the Python interpreter in VS Code (server side context)

Choose interpreter (VS Code, connected to server)

bash
Ctrl+Shift+P  Python: Select Interpreter  pick the "hls25" conda env

Copying Files To/From the Server (scp basics)

Upload a file to the server

bash
scp path/to/localfile.txt onid@babylon.eecs.oregonstate.edu:~

Download a file from the server

bash
scp onid@babylon.eecs.oregonstate.edu:~/remotefile.txt .

Copy a folder recursively

bash
scp -r path/to/localfolder onid@babylon.eecs.oregonstate.edu:~

Advanced SSH Config (Optional)

Jump host / bastion (ProxyJump)

ProxyJump example (Local Machine)

bash
Host osu
  HostName access.engr.oregonstate.edu
  User onid
  IdentityFile ~/.ssh/id_ed25519

Host babylon
  HostName babylon.eecs.oregonstate.edu
  User onid
  IdentityFile ~/.ssh/id_ed25519
  ProxyJump osu

Port forwarding (handy for Jupyter)

LocalForward example (Local Machine)

bash
LocalForward 8888 localhost:8888

Other options (use with care)

Extra options (Local Machine)

bash
Port 2222
# The following weaken security - avoid unless you understand the risks.
StrictHostKeyChecking no
UserKnownHostsFile /dev/null

X11 forwarding (GUI apps over SSH)

X11 (Local Machine)

bash
ssh -X onid@babylon.eecs.oregonstate.edu
# or (less strict)
ssh -Y onid@babylon.eecs.oregonstate.edu

Recommended Python Setup: Conda (Server Side)

Why Conda (Miniforge): prebuilt packages from conda-forge reduce compiler errors and dependency issues.

Install Miniforge (Server Side)

bash
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh -b -p "$HOME/miniforge3"
"$HOME/miniforge3/bin/conda" init bash
source ~/.bashrc

Create & use the course environment (Server Side)

bash
conda create -n hls25 python=3.11 -y
conda activate hls25
conda install numpy scipy matplotlib -y

Fallback Python Setup: venv (Server Side, not recommended)

Use only if Conda cannot be used on the server.

Load Python module (Server Side; some clusters require modules)

bash
module load python/3.11

Create & activate venv (Server Side)

bash
python -m venv ~/hls25-venv
source ~/hls25-venv/bin/activate
pip install --upgrade pip

Deactivate venv (Server Side)

bash
deactivate

Troubleshooting (Read top to bottom)

"Host key verification failed" or server identity changed

Clear old host keys (Local Machine)

bash
ssh-keygen -R babylon.eecs.oregonstate.edu

"Connection closed" or cannot reach port 22

Check port reachability (Local Machine)

bash
# Linux/macOS/WSL
nc -zv babylon.eecs.oregonstate.edu 22

# Windows PowerShell
Test-NetConnection babylon.eecs.oregonstate.edu -Port 22

Still asks for a password (keys not used)

Verify server-side permissions (Server Side)

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Remove CRLF from authorized_keys (Server Side)

bash
sed -i 's/\r$//' ~/.ssh/authorized_keys

Verbose SSH to see why it fails (Local Machine)

bash
ssh -vvv onid@babylon.eecs.oregonstate.edu

VS Code won't connect or can't find Python

VS Code tips

bash
1) Ensure you can SSH from a normal terminal first.
2) In VS Code (connected), Ctrl+Shift+P → Python: Select Interpreter → pick "hls25".
3) If your key has a passphrase, ensure an SSH agent is running and the key is added.

MobaXterm bundles SSH and X11, but for this course the supported path is:

  1. Windows WSL (Ubuntu) for a consistent Linux shell.
  2. SSH keys + VS Code Remote SSH for editing and running code on the server.
  3. Conda (Miniforge) to manage Python environments. This stack minimizes platform-specific issues and matches the tools used in later labs.

Quick Reference (Cheat Sheet)

One-time setup (Local Machine)

bash
# Windows only (PowerShell as Admin)
wsl --install -d Ubuntu

# Everyone (Linux/macOS/WSL)
ssh-keygen -t ed25519 -C "onid@oregonstate.edu"

Copy key & fix perms

bash
# Linux/macOS/WSL
ssh-copy-id -i ~/.ssh/id_ed25519.pub onid@babylon.eecs.oregonstate.edu

# Server Side
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Connect

bash
ssh onid@babylon.eecs.oregonstate.edu
# or (with config)
ssh babylon

Conda environment (Server Side)

bash
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh -b -p "$HOME/miniforge3"
"$HOME/miniforge3/bin/conda" init bash
source ~/.bashrc

conda create -n hls25 python=3.11 -y
conda activate hls25

Was this page helpful?