A Rust port of Eternal Terminal — a remote shell that automatically reconnects without interrupting the session.
Wire-compatible with upstream protocol version 6: an et.rs client can talk to a C++ etserver, and a
C++ et client can talk to an et.rs server, in both terminal and port-forwarding modes. On the server
host, etserver and etterminal can also come from different implementations.
How we track upstream (Rust rewrite, not a C++ git fork): docs/upstream-factory.md.
Windows is a first-class target. Upstream has no native server there, so hosting a session on
Windows meant running the POSIX server inside WSL and landing in a WSL shell. et.rs runs the server
and the per-session terminal natively on Windows using ConPTY, so et gives you a real cmd.exe or
PowerShell — no WSL involved.
Upgrading an existing server: the default config path is now /etc/et.cfg,
not /etc/et/config. Save your old settings before upgrading. After installing,
copy/merge them into /etc/et.cfg before starting/restarting the new server (do not
overwrite an existing customized file), or explicitly keep
--cfgfile=/etc/et/config in your own unit. There is no automatic migration
or legacy-path fallback. An existing /etc/systemd/system/et.service overrides
the AUR package's unit: update it to use the intended config and --logtostdout,
or deliberately remove it to use the packaged unit. After updating a unit, run
sudo systemctl daemon-reload; use sudo systemctl restart et to apply changes
to an already running server (enable --now alone does not restart it).
brew install minpeter/tap/et-rsInstalls et plus the etserver, etterminal, htm, and htmd role symlinks. The formula
conflicts with the upstream et formula — et.rs is a drop-in replacement, so uninstall one before
installing the other. Upgrade later with brew upgrade et-rs.
yay -S et-rs-bin
# or
paru -S et-rs-binInstalls the prebuilt release binary (x86_64, aarch64) with the role symlinks. Conflicts with the
eternal-terminal package for the same drop-in-replacement reason.
Also installs /etc/et.cfg (preserving local edits on upgrades) and et.service.
Enable the server explicitly with sudo systemctl enable --now et.
Every release ships archives (with .sha256
checksums) for Linux (gnu/musl, x86_64/aarch64), macOS (x86_64/aarch64), and Windows (x86_64).
The tarballs already contain the role symlinks. Linux tarballs also contain
etc/et.cfg and systemctl/et.service; extract first rather than unpacking all files into bin:
curl -LO "https://github.com/minpeter/et.rs/releases/latest/download/et-VERSION-TARGET.tar.gz"
tar -xzf et-VERSION-TARGET.tar.gz
cd et-VERSION-TARGET
sudo install -m755 et /usr/local/bin/et
for role in etserver etterminal htm htmd; do
sudo ln -sf et "/usr/local/bin/$role"
doneTo run the server on boot (Linux), install the bundled templates. Keep an existing
/etc/et.cfg; edit it as needed before enabling the service:
if ! sudo test -e /etc/et.cfg; then
sudo install -m644 etc/et.cfg /etc/et.cfg
fi
# The package unit uses /usr/bin; manual installs use /usr/local/bin.
sed 's|/usr/bin/etserver|/usr/local/bin/etserver|' systemctl/et.service |
sudo tee /etc/systemd/system/et.service >/dev/null
sudo systemctl daemon-reload
sudo systemctl enable --now et # and open 2022/tcp in your firewallThe resulting unit runs
ExecStart=/usr/local/bin/etserver --cfgfile=/etc/et.cfg --logtostdout in the foreground,
with logs also available through journalctl -u et (normal file logging remains enabled).
A missing default /etc/et.cfg is allowed for direct CLI use;
an explicitly selected file (including the service's /etc/et.cfg) must be readable.
CLI options override values in the selected INI file. Homebrew still installs only
the binary and role symlinks; these systemd instructions are for Linux tarballs/AUR.
cargo build --release # host
cargo build --release --target x86_64-pc-windows-gnu -p et # et.exeRequires protoc (Protocol Buffers compiler) and a C toolchain (cc, make) on
the build host: the wire crypto links the bundled libsodium, which is compiled
from source.
One binary provides every role, selected by argv[0] (busybox-style symlinks) or by a leading
subcommand:
| Upstream binary | et.rs invocation | Windows |
|---|---|---|
et |
et <host> / et client <host> |
yes |
etserver |
etserver / et server |
yes |
etterminal |
etterminal / et terminal |
yes |
htm |
htm / et htm |
yes |
htmd |
htmd / et htmd |
yes |
ln -s et etserver && ln -s et etterminal && ln -s et htm && ln -s et htmdet user@host
et --command 'uptime' user@host:2022
et --tunnel 8080:80 --reversetunnel 9000:9000 user@host
et --forward-ssh-agent user@host
et --jumphost jump.example --jport 2022 \
--jserverfifo /tmp/etserver.fifo1 dst:2022 # ET-native jumphost relay
etserver --daemon --pidfile /var/run/etserver.pid
htm # headless terminal multiplexerThe client follows upstream's SSH-style argument parsing. Put all client
options before the host; everything after the host is the remote command,
including words beginning with -. For example, et -T host printf hello
runs printf hello remotely without a PTY.
Several short options have changed meaning since et.rs 0.0.25. Use these long options to preserve an existing script's ET-specific behavior:
| Old client invocation | Replacement | New short-option meaning |
|---|---|---|
-p 2022 |
--port 2022 |
SSH bootstrap port |
-c 'command' |
--command 'command' |
SSH cipher selection |
-t 8080:80 |
--tunnel 8080:80 |
Request a PTY |
-l /path/to/logs |
--logdir /path/to/logs |
SSH username |
-e |
--noexit |
Accept an SSH escape character argument (no local escape handling) |
-f |
--forward-ssh-agent |
Background the client |
-x |
--kill-other-sessions |
Accepted as the SSH no-X11 option |
-v 2 |
--verbose 2 |
Repeated SSH verbosity (-vv) |
-N |
--no-terminal |
No remote shell, for forwarding-only sessions |
-V |
--version |
OpenSSH-compatible version query |
These are client changes; server-role options are unchanged. A wire-compatible connection does not make old and new client command lines interchangeable.
ET reads effective configuration through bounded, deadline-limited ssh -G -T,
including OpenSSH's Host/Match/Include and command-line -o precedence.
When SetEnv is present, ET performs a second query with a SetEnv override and
requires every byte outside the environment block to match. This prevents an
embedded newline from becoming a routing/forwarding directive. Both queries share
the original deadline. Match exec may consequently run again; changing config
or nondeterministic Match results fail closed rather than using inconsistent data.
SendEnv imports only local variables matching configured patterns; disabling SSH
config does not implicitly send LANG or LC_*. Effective SetEnv still wins.
Configured RemoteCommand gets its own sentinel query to reject multiline
configuration injection; ET applies the command to the session, not bootstrap.
ProxyJumpsupplies the ET-native jumphost unless--jumphostis given. Only one[user@]host[:sshport]hop is supported, including bracketed IPv6; multi-hop and malformed/injection-shaped targets are rejected before bootstrap. The SSH port does not replace the ET--jport.--forward-ssh-agentorForwardAgent yesenables agent forwarding and, on Unix, records the OpenSSHsession-bind@openssh.comrequest the bootstrap ssh makes (OpenSSH 8.9+). That binding is replayed on each forwarded agent connection, sossh-add -hdestination constraints work as they do withssh -A. A jumphost binding is replayed first. If ssh makes no binding (older OpenSSH, or an existing ControlMaster), ET logs a warning and forwarded connections stay unbound. Socket selection is--ssh-socket→IdentityAgent→SSH_AUTH_SOCK.IdentityAgent nonedisables forwarding unless a CLI socket overrides it;IdentityAgent SSH_AUTH_SOCKselects the environment socket. A socket option alone does not enable forwarding. Literal paths (including spaces and OpenSSH-expanded~) are supported; unresolved$/%substitutions and path-valuedForwardAgentare rejected. An explicit--ssh-socketorIdentityAgentis pinned for the life of that client process. Saved-session attach uses the currentSSH_AUTH_SOCK; when it is absent ET clears a stale proxy link. Use a consistentTMPDIRacross attach; secure proxy directories are retained across detach for later retargeting.LocalForward,RemoteForward, andDynamicForwardare imported from SSH configuration. An ordinary imported remote bind failure is fatal because the ET wire protocol has no per-row optional flag. Configured local/dynamic failures followExitOnForwardFailure. Reverse SOCKS and remote allocated port0cannot be represented by ET and are rejected or skipped with a diagnostic.- Effective
SetEnvassignments enter the initial payload for every session shell. Values retain spaces, quotes, backslashes, empty strings, and additional=signs. OpenSSH's effective first value wins for duplicate names.SetEnvtakes precedence over variables selected bySendEnvand over the bootstrapTERM; forwarding-generated environment names take precedence overSetEnvandSendEnv. Names must be POSIX identifiers; supported values are single-line, NUL-free, and at most 4096 bytes. OpenSSH's unescaped dump cannot distinguish a newline followed by anothersetenv NAME=valuerow from a separate assignment, so multiline values are not a supported lossless representation. Entries share the 128-name and 64-KiB terminal/jumphost packet budgets: explicit entries are considered beforeSendEnv, and entries that do not fit are omitted. Non-POSIX sessions also receiveSetEnvandSendEnv, with first-wins case-insensitive name deduplication and reserved-name checks. These limits apply to what theetclient sends, so et.rs 0.0.43 and older servers keep working. An et.rsetserverandetterminalaccept what an ET C++ client sends, like upstream: messages up to 128 MiB, any number of variables of any length, and any namesetenvaccepts.
Use a private directory for the literal ControlPath (OpenSSH % tokens are not
expanded). Start a master, run a passenger command, then stop the local owner:
mkdir -m 700 -p ~/.et/mux
et -M -f -S ~/.et/mux/work -o ControlPersist=yes user@host
et -S ~/.et/mux/work user@host uptime
et -S ~/.et/mux/work -O exitMux v4 supports command/interactive passengers, check, stop, exit, and
local TCP/Unix forwarding forward/cancel. Cancel closes the listener, not
accepted streams. The shared shell accepts one passenger at a time; remote,
dynamic, stdio, X11, subsystem, and per-passenger agent requests are rejected.
Background startup keeps the controlling terminal through SSH authentication
so password, passphrase and host-key prompts work, then detaches stdio before
the session pump starts.
-N starts a forwarding-only session without a remote shell; --no-terminal
retains its older meaning of disabling the client terminal while starting a shell.
-N, -W, and --no-terminal with port forwards are closed 5 minutes after
the client disconnects unless --disconnect-timeout sets another limit (0
keeps the session). A bare --no-terminal session stays available to reconnect.
et --ctl --name work user@host starts a background control session and prints
its private local socket path. The byte protocol exposes input, resize, output
cursors, status, a transcript with secret-input redaction, and local shutdown.
Repeating --ctl --name work adopts that saved session without replaying its
startup command, provided the resolved host, ET port and remote user match.
Older records without a remote user require explicit --attach work rather
than automatic adoption. A definite invalid-key response replaces only the
matching stale record with a fresh session; transport errors preserve it.
--no-persist disables saving and automatic adoption. Control
shutdown and mux exit leave a saved remote shell attachable; --kill work
explicitly ends the remote session. A definite remote end removes matching saved
control-session credentials, allowing the same name to start a fresh session.
Raw -T masters/control sessions (except forwarding-only -NT), stdio -W
control sessions, and Windows local mux/control/background modes are unsupported.
Raw -T passengers are rejected too; independent OpenSSH mux clients must request
a PTY (-tt). ControlPersist retains a live shared shell, not one that has
already exited remotely. Local socket paths require private owner-only directories;
user-controlled symlink ancestors are rejected.
# on the Windows machine (needs Windows 10 1809+ for ConPTY)
et.exe server --daemon --port 2022 --pidfile "%LOCALAPPDATA%\etserver\etserver.pid"
netsh advfirewall firewall add rule name="et" dir=in action=allow protocol=TCP localport=2022# from anywhere
et user@windows-host:2022 # auto-detects cmd.exe login shell
et --winserver user@windows-host:2022 # explicitly force cmd.exe bootstrap
et --remote-shell powershell user@windows-host:2022 # PowerShell sessionBare clients run a credential-free %ComSpec% SSH probe before bootstrap. An expanded cmd.exe
path selects the Windows bootstrap (no printf, CRLF lines, & separator) and defaults
--terminal-path to et.exe; a literal %ComSpec% preserves POSIX behavior. --winserver
remains the explicit override. The session shell follows %COMSPEC%, or ET_SHELL if set on the
server. OpenSSH on Windows must be reachable.
- Protocol v6 handshake,
crypto_secretbox(XSalsa20-Poly1305) framing, sequence numbers, and catch-up buffers, pinned to upstream bytes by golden fixtures infixtures/wire.json. - Reconnecting client and server sessions with backed reader/writer replay.
- Non-TTY sessions survive local input EOF (including redirected Windows handles)
while reporting recognizable SSH bootstrap diagnostics.
Like
ssh -T, a raw-Tcommand sees EOF when the client's stdin ends (et -T host 'wc -c' < filefinishes). This needs an et.rs client and an et.rsetterminal; ET C++ has no such signal, so its client or terminal leaves the command reading. On a terminal, Ctrl-D in-Tends the command's input instead of closinget.-Whas separate half-close semantics. - SSH bootstrap (
IDPASSKEYhandshake), remote PTY, window resize, keepalives,--commandexecution, and--no-terminalmode. - Forward, reverse, Unix-socket, port-range, environment-variable named-pipe, and ssh-style
(
bind_address:port:host:hostport, bracketed IPv6) tunnels. - SSH-agent forwarding via a server-created socket exported as
SSH_AUTH_SOCK. - Remote PTYs export their actual path as
SSH_TTY; server disconnect defaults are configurable in minutes with--disconnect-timeoutor INI[Networking] disconnect_timeout(0disables the global default). Forward-only sessions fill that same per-session field with 5 minutes when the client flag is omitted, so etserver reaps them after the client is gone. Interactive sessions still leave the field unset. Upstream EternalTerminal uses one server default for every session and does not special-case forward-only clients. - ET-native jumphost relay (client,
etserverJUMPHOST_INITdispatch, andetterminal --jump). etserverINI configuration, daemon mode with pid file, log files honouring--logdir,--logtostdout,--silent,--verbose, and log rollover.- Headless terminal multiplexer (
htm/htmd) with upstream's base64 IPC framing, JSON state, tabs/splits/panes, and pane buffer replay. - Native Windows server and terminal: ConPTY shells, a loopback router authenticated with a per-server token, job-object breakaway so sessions survive the bootstrap ssh, and a console client that maps keys (including navigation keys upstream drops) to ANSI sequences.
- No telemetry:
--telemetryis accepted for compatibility and ignored. #![forbid(unsafe_code)]across every crate.
- The router is a loopback TCP listener; its address and a CSPRNG token live in the
--serverfifoendpoint file under%LOCALAPPDATA%\etserver, which takes the place of Unix socket permissions. - HTM runs native ConPTY panes on Windows 10 1809+; use
et.exe htmfrom an HTM-capable terminal emulator. It is a protocol relay, not a standalone pane UI. The pane shell isSHELL, thenCOMSPEC, thencmd.exe; its home isUSERPROFILE. - HTM IPC uses an authenticated loopback endpoint at
%LOCALAPPDATA%\et-htm\htm.ipc. The endpoint inherits the user-private application directory ACL, like the router.--socketon both HTM roles selects an isolated endpoint; on Windows it must remain below that user'sLOCALAPPDATAtree, without junctions or parent traversal. Do not grant other users access to this directory or its token files.htm -xshuts down only the selected authenticated daemon, not named fleet processes. - HTM first requests Windows job breakaway. If the host denies it, HTM reports the
restriction and starts a detached, handle-isolated daemon within the host job.
It survives the launching
htmclient, but not termination of that host job. The stricteretserver/etterminalSSH-bootstrap breakaway policy is unchanged. - Unix-socket tunnels remain POSIX-only.
- Inbound connections need a firewall rule; the server does not modify firewall state itself.
Unix integration tests require system OpenSSH (ssh) for independent mux
interoperability coverage. PTY/process tests should run serially on shared runners.
cargo test --workspace -- --test-threads=1Apache-2.0