SSH and MFA
SSH and MFA
Use this guide to set up SSH for CSAIL systems. The recommended configuration
routes connections through jump.csail.mit.edu, where you complete Duo MFA
once and then reuse that authenticated connection throughout your workday.
This works for login.csail.mit.edu, Slurm, and other CSAIL hosts. You do not
log in to the jump host itself; it securely forwards you to the system you want
to use.
Quick version: Configure SSH once, then connect with ssh login or
ssh hostname. Your first connection opens the jump-host session and prompts
for Duo. Later connections reuse it.
Before you begin
Before troubleshooting SSH, confirm that your CSAIL account password works at my.csail.mit.edu. If it does not, contact help@csail.mit.edu for account help.
You also need CSAIL Duo enrollment. Sign in at duo.csail.mit.edu to set up or review your Duo preferences. CSAIL Duo and MIT Duo are separate systems: being enrolled in MIT Duo does not automatically enroll your phone in CSAIL Duo.
For passwordless SSH, configure Kerberos on your client and obtain tickets
with kinit <username>@CSAIL.MIT.EDU (the realm is case-sensitive). CSAIL
Linux includes this configuration already; see the platform-specific links
below for other systems.
CSAIL generally does not recommend public-key authentication: it is not compatible with AFS home directories. The configuration below uses your CSAIL account authentication and Duo instead.
Set up your SSH configuration
The following configuration is the recommended starting point for macOS, non-CSAIL Linux, and Windows Subsystem for Linux (WSL). First create the directory that holds the local control sockets:
mkdir -p ~/.ssh/cm_socket
Then create or edit ~/.ssh/config and add the following near the top of the
file.
HashKnownHosts yes
VerifyHostKeyDNS ask
CanonicalizeHostname always
CanonicalDomains csail.mit.edu
# Use CSAIL authentication for CSAIL hosts.
Host *.csail.mit.edu
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
ForwardAgent yes
# If your local username differs from your CSAIL username, uncomment:
# User <your-username>
# Route every CSAIL destination except the jump host through the jump host.
Host *.csail.mit.edu !jump.csail.mit.edu
ProxyJump jump.csail.mit.edu
# Keep the authenticated jump-host connection available for 8 hours after use.
Host jump.csail.mit.edu
ControlMaster auto
ControlPersist 8h
ControlPath ~/.ssh/cm_socket/%C
Set safe permissions on the configuration file:
chmod 600 ~/.ssh/config
The configuration also routes login.csail.mit.edu through the jump host.
Direct access to login is possible, but using the same path for every CSAIL
destination keeps the configuration simpler and lets all connections reuse the
same Duo-authenticated session.
Platform notes
- macOS: See SSH on macOS for platform-specific Kerberos information.
- Linux: See SSH on Linux
if you need to configure Kerberos on a non-CSAIL system. On CSAIL Linux, use
the provided configuration; if you need to set
ControlPathmanually, use/run/user/%i/cm_socket/%Crather than an AFS home directory. - Windows: Use OpenSSH through WSL for the full persistent-connection workflow, especially for Slurm. Native Windows SSH clients do not support this control-socket workflow.
Connect for the first time
After saving the configuration, connect to a CSAIL host. The public login service is a good first test:
ssh login
Your SSH client may ask you to confirm a host key the first time you connect. If it reports a changed key, do not accept it until you have checked the SSH host key fingerprints.
You will then be prompted for Duo MFA. It looks like this, with your own phone number shown:
Enter a passcode or select one of the following options:
1. Duo Push to XXX-XXX-XXXX
2. Phone call to XXX-XXX-XXXX
3. SMS passcodes to XXX-XXX-XXXX
Passcode or option (1-3):
Enter 1 for a Duo Push, 2 for a phone call, 3 for SMS passcodes, or enter
a passcode. Once you approve the request, you are connected to login and the
jump-host session is ready for later connections.
Connect to CSAIL systems
With the configuration in place, use ordinary SSH commands. Short host names
work because the configuration completes them with csail.mit.edu.
# Public login service
ssh login
# A CSAIL workstation or research host
ssh hostname
# Slurm login service
ssh slurm-login
The jump host is used automatically. Do not try to use it as an interactive
login server; it is a forwarding service. Running ssh jump.csail.mit.edu
may end with Shared connection to jump.csail.mit.edu closed; that is expected
and does not indicate a connection problem.
Use slurm-login, not individual numbered Slurm login nodes. The Slurm login
service is for scheduling jobs only; do not run VS Code, Cursor, Claude, or
other interactive coding tools there.
Why Duo does not prompt every time
ControlPersist 8h keeps the jump-host master connection available for eight
hours after your last SSH connection closes. It does not ask you to
reauthenticate every eight hours. While the master connection is available,
new terminals, scp/rsync commands, and connections to other CSAIL hosts
reuse it instead of prompting for Duo again.
In practical terms, regular use can continue throughout the day without another Duo prompt. Subsequent connections open channels through the existing MFA-authenticated jump-host connection; they do not trigger another MFA check at the jump host.
You can check whether that persistent connection is active:
ssh -O check jump.csail.mit.edu
If it reports Master running, the connection is ready. A new Duo prompt is
expected only after the master connection has ended—for example, after eight
hours with no SSH sessions, a network change, a reboot, or socket cleanup.
VS Code, Cursor, and coding agents
Before starting VS Code, Cursor, Claude Code, Codex, or another tool that uses
SSH behind the scenes, first connect manually with ssh login and complete
Duo. This prevents the tool from getting stuck at an MFA prompt or repeatedly
retrying a failed connection.
For VS Code and Cursor setup, including the AFS-specific settings they need, see Using SSH with VS Code and Cursor.
For coding agents, read Agentic Coding Best Practices before you start. In particular, an agent that cannot connect must stop and ask for help rather than retrying; repeated failures can trigger a temporary block.
Do not run interactive coding tools or coding agents on login.csail.mit.edu
or slurm-login.csail.mit.edu. Use a workstation, a group server, or an
allocated Slurm compute node instead.
Troubleshooting
I am prompted for Duo every time
Make sure the ControlMaster, ControlPersist, and ControlPath lines are in
your ~/.ssh/config, then check the persistent connection:
ssh -O check jump.csail.mit.edu
If no master is running, connect again with ssh login and complete Duo.
I cannot sign in or never receive a Duo prompt
First confirm that your CSAIL password works at my.csail.mit.edu and that your phone is enrolled at duo.csail.mit.edu. Remember that CSAIL Duo is separate from MIT Duo.
SSH hangs before connecting after I changed networks
Recent OpenSSH clients will often notice that a control socket is no longer usable after a network change and reconnect automatically. Older clients can instead leave a stale socket behind, which makes a new SSH command appear to hang. Remove the old socket, then reconnect and complete Duo again:
rm -f ~/.ssh/cm_socket/*
ssh login
It is safe to remove these control sockets; the next connection simply creates a new one.
The command above is for the macOS, non-CSAIL Linux, and WSL configuration on
this page. CSAIL Linux uses a runtime-directory socket rather than an AFS home
directory; use rm -f /run/user/$(id -u)/cm_socket/* if you need to clear its
socket.
SSH reports that a host key changed
Do not bypass the warning. Compare the fingerprint shown by SSH with the published SSH host key fingerprints. If it matches, remove the old entry and reconnect:
ssh-keygen -R hostname.csail.mit.edu
Replace hostname.csail.mit.edu with the host named in the warning.
A tool keeps retrying after an SSH failure
Stop the tool first. Do not let an IDE or coding agent repeatedly retry a failed
connection. Re-establish your manual ssh login session, then restart the tool.
I still need help
Include the command you ran, the full error message, your operating system, and whether ordinary terminal SSH works. Do not send passwords, private keys, Kerberos tickets, or Duo passcodes. Contact help@csail.mit.edu.


