Kerberos-authenticated SSH from Windows
There are two recommended ways to log into department-managed Unix/Linux servers from Windows using Kerberos-authenticated SSH: directly from Windows Terminal, or through Windows Subsystem for Linux (WSL).
Getting a Kerberos ticket on Windows
If you connect from Windows Terminal or VS Code rather than from inside WSL, SSH needs a Kerberos ticket from Windows itself. Windows Credential Manager can obtain these for you automatically once you’ve stored your departmental credentials. This is a one-time setup:
- Click the Start button, press the Windows key, or click the search box on the taskbar.
- Type Credential Manager and open the Credential Manager Control Panel.
- Click Windows Credentials.
- Click Add a Windows credential.
- Fill in the fields as follows:
- Internet or network address:
*.cl.cam.ac.uk - Username:
[Javascript required](substitute your CRSID) - Password: your departmental Kerberos (lab) password
- Internet or network address:
- Click OK and close Credential Manager.
SSH from Windows Terminal
Recent versions of Windows include an OpenSSH client. Once Credential Manager is set up (see above), you can connect from Windows Terminal, using either Command Prompt (cmd) or PowerShell, for example:
ssh -K [Javascript required]
SSH via Windows Subsystem for Linux (WSL)
If you use Windows Subsystem for Linux (available on Windows 10 or later), you can use the SSH client that comes with any of the Linux distributions in the Microsoft Store (e.g. Ubuntu).
Install WSL
On Windows 10 (version 2004 or later) and Windows 11, one command does both:
- Click the Start button and type PowerShell.
- Right-click Windows PowerShell and choose Run as administrator.
- Run:
wsl --install
- Restart your computer when prompted.
This enables WSL and installs Ubuntu by default. After the restart, Ubuntu finishes installing and asks you to create a Linux username and password.
Install Kerberos
First, update the distribution. Open wsl and run:
$ sudo apt-get update
$ sudo apt-get upgrade
Then install the Kerberos client package:
$ sudo apt-get install krb5-user
When prompted for the Default Realm,
enter DC.CL.CAM.AC.UK. The installation will
then complete.
Connecting
Acquire a Kerberos ticket, then connect:
$ kinit crsid Password for [Javascript required]: <departmental Kerberos (lab) password>$ ssh -K [Javascript required]
For kinit to succeed, you must be
on the University or Departmental network, either directly or via a
VPN. If your target host isn’t reachable, connect first to a
gateway machine such as slogin, then SSH on
from there.
SSH with key pair
You can authenticate with an SSH key pair to one of our SSH servers. From there, you can use Kerberos to SSH to other internal machines.
Generate a key
The same command works in WSL and in Windows Terminal (cmd or PowerShell):
ssh-keygen -t ed25519 -C "crsid@laptop"
Accept the default location and set a passphrase. This creates two files:
id_ed25519is your private key. Never share it.id_ed25519.pubis your public key, which is the one you upload.
Note that WSL and Windows keep separate ~/.ssh folders. A key generated in WSL isn’t visible to
Windows Terminal, and vice versa, so generate the key in whichever
environment you’ll connect from.
Add the public key
Display your public key:
cat ~/.ssh/id_ed25519.pub # WSL
type $env:USERPROFILE\.ssh\id_ed25519.pub # PowerShell
Copy the whole line, then add it to the department’s key store:
- Go to sshkeys.cl.cam.ac.uk.
- Click New SSH key.
- Paste your public key into the box.
- Click Add SSH Key.
Connect
ssh [Javascript required]
You’ll be asked for your key’s passphrase (not your Kerberos password). Once here, you can generate a Kerberos ticket and SSH using Kerberos to other internal machines.
SSH from VS Code
VS Code can also use tickets obtained via Credential Manager. Set that up first (see above), then see our VS Code wiki page for some user-contributed guidance.