Workflows remote - uhop/dotfiles GitHub Wiki

Workflows: remote

Day-to-day remote access. For one-time SSH and machine setup see Setting Up a New Machine. For tmux configuration see Application Notes. For running GUI programs on a remote host and displaying them locally, see Remote GUI.

Connecting

All remote-access helpers attach to (or create) a tmux session on the remote host, so disconnections do not kill running commands.

Command Transport Notes
ssht host [session] SSH Primary choice. Works everywhere.
mosht host [session] Mosh Better on high-latency or unreliable links.
ett host [session] Eternal Terminal Survives IP changes and sleep/wake.
kssht host [session] Kitty SSH + tmux Uses Kitty's built-in SSH (kitten ssh).

The default session name is ssh_tmux. Using the same name from multiple connections shares the session. Detach with Ctrl+b d without closing it.

Nested tmux sessions

When running tmux both locally and on a remote host, Ctrl+b is captured by the local session. Press Ctrl+b twice to send the prefix to the inner (remote) session. For example, to detach the remote session without affecting the local one: Ctrl+b Ctrl+b d.

Fleet management with playbash

For managing multiple remote hosts โ€” maintenance playbooks, script deployment, file transfers โ€” see Playbash Server Management.

Prerequisite: every host in the playbash inventory must be reachable via passwordless SSH with connection multiplexing. Both are configured by this project โ€” see Setting Up a New Machine ยง SSH.

Quick reference:

Command What it does
playbash run all daily Run the daily maintenance playbook on all hosts.
playbash run all weekly Run the weekly maintenance playbook on all hosts.
playbash exec all -- "command" Run an ad-hoc command on all hosts.
playbash push all ./script.sh Upload and run a local script on all hosts.
playbash put all local remote Transfer a file to all hosts.
playbash log View the latest run log.

Playbash and SSH requirements

Playbash relies on two SSH features configured by this project:

  1. Passwordless key-based access. Every host in the inventory must accept key authentication without a password prompt. By default, playbash detects interactive sudo/doas/password prompts and kills the connection to avoid hanging playbooks. For hosts that need a sudo password, pass --sudo โ€” playbash prompts once and injects the password when sudo asks (see Playbash ยง Sudo support).

  2. Connection multiplexing. The ControlMaster auto / ControlPersist 5m settings in ~/.ssh/config allow playbash to reuse a single connection per host across multiple operations (pre-flight check, playbook run, sidecar fetch, file transfers). Without multiplexing, each SSH invocation performs a full handshake, which slows fan-out significantly and can trigger rate limits on hosts with MaxStartups set.

Other considerations:

  • Vanilla hosts (in the inventory, without chezmoi) get playbooks auto-pushed to ~/.cache/playbash-staging/, and their status line says (pushed). They still need passwordless SSH access, and python3 for run, push, and exec. A host the inventory does not list is refused.
  • Passwordless privilege escalation on remotes. Remote hosts need passwordless sudo (or doas) for maintenance commands (upd, cln, etc.). chezmoi init --apply configures this automatically by writing /etc/sudoers.d/chezmoi with NOPASSWD rules tailored to the platform (apt on Debian/Ubuntu, dnf on RHEL/Fedora, softwareupdate on macOS). If doas is installed and /etc/doas.conf exists, both sudoers and doas rules coexist โ€” the doas alias handles interactive shells while sudoers covers cron and non-interactive contexts. Hosts where neither is in place will trigger playbash's sudo-detection kill.
โš ๏ธ **GitHub.com Fallback** โš ๏ธ