Skip to main content

Windows SSH

# Windows SSH with X Forwarding

This guide explains how to connect to the GRIT HPC system from Windows using SSH with X11 forwarding so graphical applications can display on your local machine.

---

## 1. Install an X Server (Xming)

Install **Xming** using `winget`.

Open **Command Prompt** or **PowerShell** and run:

winget install Xming

After installation, start Xming from the Start Menu.


2. Configure the DISPLAY Variable

Set the DISPLAY environment variable so remote X11 applications know where to send their output.

Run:

setx DISPLAY localhost:0

Close and reopen your terminal after running this command so the environment variable takes effect.


3. Set Up SSH Key Authentication (Recommended)

Using SSH keys avoids typing your password every time and is more secure.

Generate an SSH Key

Open PowerShell and run:

ssh-keygen -t ed25519

Press Enter to accept the default file location:

C:\Users\<username>\.ssh\id_ed25519

You may optionally set a passphrase.


Copy the Key to the HPC System

If ssh-copy-id is available:

ssh-copy-id [netid]@hpc.grit.ucsb.edu

If it is not available on Windows, run:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh [netid]@hpc.grit.ucsb.edu "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Ensure the permissions on the HPC system are correct:

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

4. Connect to the HPC System

Connect with X11 forwarding enabled:

ssh -Y [netid]@hpc.grit.ucsb.edu

The -Y flag enables trusted X11 forwarding, allowing graphical applications to display on your Windows desktop.


5. Test X Forwarding

After connecting, test with a simple X application:

xclock