264 lines
5.6 KiB
Markdown
264 lines
5.6 KiB
Markdown
---
|
|
title: Remote Hermes CLI Access via SSH and tmux
|
|
created: 2026-10-17
|
|
updated: 2026-10-17
|
|
type: concept
|
|
tags: [kb, homelab, ai, tool, workflow, concept]
|
|
sources: [/opt/data/raw-sources/host-ssh-container-tmux-hermes-tui.md]
|
|
confidence: medium
|
|
contested: false
|
|
---
|
|
|
|
# Remote Hermes CLI Access via SSH and tmux
|
|
|
|
Run `tmux` on the VPS host, not inside the Hermes container. A host-side session survives SSH disconnects and does not modify an ephemeral container.
|
|
|
|
The connection chain is:
|
|
|
|
```text
|
|
home CLI → SSH over Tailscale → host tmux → container exec → Hermes TUI
|
|
```
|
|
|
|
The source environment was verified as follows:
|
|
|
|
- Hermes executable: `/opt/hermes/bin/hermes`
|
|
- State and configuration: `/opt/data`
|
|
- Container OS: Debian 13
|
|
- Underlying container runtime: containerd/overlayfs
|
|
- `tmux` is not installed inside the container
|
|
|
|
## 1. Verify Tailscale on the VPS host
|
|
|
|
Access the VPS through its provider console or an existing administrative route, then run:
|
|
|
|
```bash
|
|
tailscale status
|
|
tailscale ip -4
|
|
hostname
|
|
```
|
|
|
|
Record the Tailscale hostname or `100.x.y.z` address.
|
|
|
|
If Tailscale is not installed on the host:
|
|
|
|
```bash
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
sudo tailscale up
|
|
```
|
|
|
|
Follow the authentication URL it prints.
|
|
|
|
## 2. Enable SSH access
|
|
|
|
### Recommended: Tailscale SSH
|
|
|
|
On the VPS host:
|
|
|
|
```bash
|
|
sudo tailscale set --ssh
|
|
```
|
|
|
|
Check the Linux username:
|
|
|
|
```bash
|
|
whoami
|
|
```
|
|
|
|
Connect from a homelab machine:
|
|
|
|
```bash
|
|
ssh <username>@<vps-tailscale-hostname>
|
|
```
|
|
|
|
Example:
|
|
|
|
```bash
|
|
ssh alister@vps-3d0ee869
|
|
```
|
|
|
|
Tailscale SSH access is controlled by the tailnet access policy. If authentication is refused, add or correct the required SSH rule in that policy.
|
|
|
|
### Alternative: ordinary OpenSSH over Tailscale
|
|
|
|
On a Debian or Ubuntu VPS host:
|
|
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install -y openssh-server
|
|
sudo systemctl enable --now ssh
|
|
```
|
|
|
|
Test from home using the Tailscale address:
|
|
|
|
```bash
|
|
ssh <username>@100.x.y.z
|
|
```
|
|
|
|
Do not disable the existing VPS access route until the new SSH path works. An incorrect SSH or firewall change can lock you out.
|
|
|
|
## 3. Install tmux on the VPS host
|
|
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install -y tmux
|
|
tmux -V
|
|
```
|
|
|
|
## 4. Identify the Hermes container
|
|
|
|
Check Docker first:
|
|
|
|
```bash
|
|
sudo docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'
|
|
```
|
|
|
|
Find the container running Hermes, then verify the executable:
|
|
|
|
```bash
|
|
sudo docker exec <container-name> \
|
|
sh -lc 'test -x /opt/hermes/bin/hermes && echo "Hermes container confirmed"'
|
|
```
|
|
|
|
Verify the data directory and Hermes version:
|
|
|
|
```bash
|
|
sudo docker exec <container-name> \
|
|
sh -lc 'test -d /opt/data && /opt/hermes/bin/hermes --version'
|
|
```
|
|
|
|
If the host uses `nerdctl` instead of Docker:
|
|
|
|
```bash
|
|
sudo nerdctl ps
|
|
sudo nerdctl exec <container-name> \
|
|
sh -lc 'test -x /opt/hermes/bin/hermes && /opt/hermes/bin/hermes --version'
|
|
```
|
|
|
|
If neither command exists, inspect the containerd namespaces:
|
|
|
|
```bash
|
|
sudo ctr namespaces list
|
|
sudo ctr --namespace default containers list
|
|
sudo ctr --namespace k8s.io containers list
|
|
```
|
|
|
|
The exact entry command depends on the container manager that owns the container. Docker is the most likely path even when containerd is the underlying runtime.
|
|
|
|
## 5. Start a persistent host-side tmux session
|
|
|
|
SSH into the VPS:
|
|
|
|
```bash
|
|
ssh <username>@<vps-tailscale-hostname>
|
|
```
|
|
|
|
Start a new session or reattach the existing one:
|
|
|
|
```bash
|
|
tmux new-session -A -s hermes
|
|
```
|
|
|
|
Inside `tmux`, enter the container and launch Hermes:
|
|
|
|
```bash
|
|
sudo docker exec -it <container-name> \
|
|
sh -lc 'cd /opt/data && export HERMES_HOME=/opt/data && exec /opt/hermes/bin/hermes --tui'
|
|
```
|
|
|
|
If the TUI has terminal-rendering problems, pass `TERM` explicitly:
|
|
|
|
```bash
|
|
sudo docker exec -it \
|
|
-e TERM="$TERM" \
|
|
-e HERMES_HOME=/opt/data \
|
|
<container-name> \
|
|
sh -lc 'cd /opt/data && exec /opt/hermes/bin/hermes --tui'
|
|
```
|
|
|
|
The TUI now uses that Hermes instance's configuration, memory, skills, sessions, and files.
|
|
|
|
## 6. Disconnect without stopping Hermes
|
|
|
|
Detach from `tmux`:
|
|
|
|
```text
|
|
Ctrl-B, then D
|
|
```
|
|
|
|
The SSH connection can now be closed. The host-side `tmux` session and the container process remain running.
|
|
|
|
Reconnect later:
|
|
|
|
```bash
|
|
ssh <username>@<vps-tailscale-hostname>
|
|
tmux attach -t hermes
|
|
```
|
|
|
|
List existing sessions:
|
|
|
|
```bash
|
|
tmux list-sessions
|
|
```
|
|
|
|
## 7. Reduce access to one local command
|
|
|
|
On the homelab machine, add this host entry to `~/.ssh/config`:
|
|
|
|
```sshconfig
|
|
Host suzi-vps
|
|
HostName <vps-tailscale-hostname>
|
|
User <vps-linux-username>
|
|
RequestTTY force
|
|
```
|
|
|
|
Test it:
|
|
|
|
```bash
|
|
ssh suzi-vps
|
|
```
|
|
|
|
Create a host-side launcher at `/usr/local/bin/hermes-container`:
|
|
|
|
```bash
|
|
sudo tee /usr/local/bin/hermes-container >/dev/null <<'EOF'
|
|
#!/bin/sh
|
|
exec sudo docker exec -it \
|
|
-e TERM="${TERM:-xterm-256color}" \
|
|
-e HERMES_HOME=/opt/data \
|
|
<container-name> \
|
|
sh -lc 'cd /opt/data && exec /opt/hermes/bin/hermes --tui'
|
|
EOF
|
|
|
|
sudo chmod 755 /usr/local/bin/hermes-container
|
|
```
|
|
|
|
Replace `<container-name>` before saving the launcher.
|
|
|
|
The homelab command can then be:
|
|
|
|
```bash
|
|
ssh -t suzi-vps 'tmux new-session -A -s hermes /usr/local/bin/hermes-container'
|
|
```
|
|
|
|
For a shorter invocation, create a local alias:
|
|
|
|
```bash
|
|
alias suzi="ssh -t suzi-vps 'tmux new-session -A -s hermes /usr/local/bin/hermes-container'"
|
|
```
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
suzi
|
|
```
|
|
|
|
## Limitation after a container restart
|
|
|
|
If the Hermes container restarts or is recreated, the interactive Hermes process ends. The host `tmux` session may remain, but `/usr/local/bin/hermes-container` must be run again. Ordinary SSH disconnects do not affect the running process.
|
|
|
|
## Related
|
|
|
|
- [[concepts/hermes-config-loader|Hermes Config Loader]]
|
|
- [[index|Wiki index]]
|
|
- [[log|Wiki change log]]
|