Hermes Agent SSH lets your agent run its shell commands on a remote server you own, instead of on your laptop. You switch one setting, add a host and a key, and every command the agent runs happens on that machine. Here’s the exact setup from the Hermes docs, how the persistent shell works, and when SSH beats Docker or Modal.
Key takeaways
- One setting:
hermes config set terminal.backend ssh. - Needs
TERMINAL_SSH_HOSTandTERMINAL_SSH_USERin~/.hermes/.env. - Key auth only. Port defaults to 22.
- Keeps the dangerous-command check, unlike container backends.
- Want an agent set up on your own server for your business? Claim a free strategy session.
What the Hermes Agent SSH backend is
Hermes ships six built-in terminal backends: local, docker, ssh, modal, daytona and vercel_sandbox. According to the configuration docs, the backend decides where the agent’s shell commands actually run. Pick ssh and they run on a remote server.
| Hermes SSH at a glance | |
|---|---|
| Switch it on | hermes config set terminal.backend ssh |
| Required | TERMINAL_SSH_HOST, TERMINAL_SSH_USER |
| Optional | TERMINAL_SSH_PORT (22), TERMINAL_SSH_KEY, TERMINAL_SSH_PERSISTENT |
| Where settings live | Host details in ~/.hermes/.env, backend in config.yaml |
| Auth | SSH key (your system default if none is set) |
1. Set it up in three steps
hermes config set terminal.backend ssh
# ~/.hermes/.env
TERMINAL_SSH_HOST=my-server.example.com
TERMINAL_SSH_USER=ubuntu
TERMINAL_SSH_KEY=~/.ssh/id_rsa # optional
TERMINAL_SSH_PORT=22 # optional
In config.yaml the same choice reads terminal: backend: ssh. The SSH backend section lists only key authentication, so set up a key on the server first. Hermes connects with BatchMode=yes, which means it never stops to ask for a password.
Want your AI agent running safely on its own server? Inside the AI Profit Boardroom you get the Agent OS — Hermes, OpenClaw, OpenCode, Claude and Codex in one place — plus step-by-step Hermes training and four live coaching calls a week.
Want a plan for your business first? Claim your free strategy session.
Join the AI Profit Boardroom →Claim Your Free SEO Strategy Session →
2. How the connection works
- SSH ControlMaster reuses one connection, with a 5-minute idle keepalive.
- Hermes connects at startup with
StrictHostKeyChecking=accept-new, so a brand-new host is accepted once and checked after that. - At startup it snapshots the remote login shell’s environment once.
- Every later command sources that snapshot, moves to the tracked working directory and runs as a fresh
ssh … bash -c.
The result feels like one long session on the server, without holding a fragile interactive shell open.
3. The persistent shell
terminal.persistent_shell is on by default. With it on, the working directory and exported variables (export FOO=bar) carry over between commands. Plain shell variables, functions and aliases you define mid-session don’t.
- Turn it off with
hermes config set terminal.persistent_shell false. - For SSH,
TERMINAL_SSH_PERSISTENTwins over the config setting. - Docker, Modal, Daytona and Vercel Sandbox ignore both settings.
Source: the persistent shell docs.
4. Passing secrets to the server safely
If a skill needs environment variables, list them in terminal.env_passthrough or let the skill declare them. Hermes forwards them with OpenSSH SendEnv, so the values never appear in the command text.
- The server’s
sshd_configneeds a matchingAcceptEnvline. Without it, the variables are silently dropped. - Hermes never forwards its own provider keys, such as
OPENAI_API_KEY. SUDO_PASSWORDgoes to whichever backend runs the command, so for SSH it’s the remote host’s sudo password.
Want this set up for you instead of doing it yourself? Claim your free strategy session →
5. SSH vs Docker, Modal and local
| Backend | Where commands run | Dangerous-command check |
|---|---|---|
| local | Your own machine, no isolation | Yes |
| ssh | A remote machine you manage | Yes |
| docker | One long-lived local container | No, the container is the boundary |
| modal | A cloud sandbox VM | No, the container is the boundary |
The security docs recommend SSH because the agent can’t modify its own code on the host. Checkpoints and /rollback also work on SSH and local, but not on container backends (source). One catch: ! commands you type in the CLI always run where Hermes runs, not on the server.
6. Hermes Desktop over SSH
This is a separate feature. terminal.backend ssh moves the agent’s commands. A Desktop SSH connection drives a whole Hermes install on another machine.
- In Desktop, open Settings → Gateways → Add connection and pick SSH.
- Enter the host as
user@host:22. User and port are optional. - The app opens the tunnel, starts the dashboard and connects using your SSH key.
- Since v0.23.0 (5 Nov 2026), Desktop keeps every gateway connected, so switching to an SSH gateway is instant, and you can open a terminal tab on it.
- An idle Desktop-owned SSH backend shuts down after 15 minutes with no client and no running turn.
Details are in the multi-connection Desktop docs and the v0.23.0 release notes. After a Hermes update, reconnect Desktop so the SSH backend restarts.
My verdict
If your agent touches anything important, give it its own server. Set the backend to SSH, use a dedicated user and key, add AcceptEnv for the variables your skills need, and keep the persistent shell on. Hermes Agent SSH is the simplest way to keep the agent off your own laptop without losing the safety checks.
About Julian Goldie
I’m Julian Goldie — founder of Goldie Agency and the AI Profit Boardroom. I test new AI agents almost every day for 432K+ YouTube subscribers and run Hermes, OpenClaw, OpenCode, Claude and Codex side by side in my own Agent OS. Claim your free strategy session or join the AI Profit Boardroom.
Want another angle? Read the AI Profit Boardroom guide to the Hermes Agent SSH backend.
FAQ: hermes agent ssh
How do I make Hermes Agent run commands over SSH?
Run hermes config set terminal.backend ssh, then set TERMINAL_SSH_HOST and TERMINAL_SSH_USER in ~/.hermes/.env.
Which SSH key does Hermes Agent use?
The key at TERMINAL_SSH_KEY. If that isn’t set, it uses your system default key. The port defaults to 22.
Can Hermes Agent log in to SSH with a password?
Only key authentication is documented, and Hermes connects with BatchMode=yes, so it never prompts for a password.
Does the shell remember my state between commands?
Yes, with terminal.persistent_shell on, which is the default. The working directory and exported variables carry over. Plain variables, functions and aliases don’t.
How is the SSH backend different from Docker or Modal?
SSH runs on a remote machine you own and keeps Hermes’s dangerous-command check. Docker and Modal run in a container or cloud sandbox and skip that check because the container is the boundary.
Why aren’t my skill’s environment variables reaching the server?
The remote sshd_config needs an AcceptEnv line for those variable names. Without it, the server silently drops them.
Ready to put Hermes to work in your business? Join the AI Profit Boardroom for the Agent OS, setup training and daily updates.
Or claim your free strategy session and we’ll map out your setup.
Starting from zero? Get the free AI course and community.
Join the AI Profit Boardroom →Claim Your Free SEO Strategy Session →Get the FREE AI Course + Community →
Related reading
Last updated November 2026. This page is a living guide to hermes agent ssh — the facts here move fast and it is updated as they do.
