session-tools/bin/tssh

21 lines
452 B
Text
Raw Permalink Normal View History

2026-04-25 22:13:25 -07:00
#!/bin/sh
# tssh <host>
#
# Interactive ssh that auto-attaches to (or creates) a per-user tmux session
# on the remote, so transport drops don't kill your shell.
#
# Detach with Ctrl-b d. Reattach by re-running this command.
# Session name: claude-$LOCAL_USER on the remote box.
set -eu
if [ $# -lt 1 ]; then
echo "usage: $0 <host>" >&2
exit 2
fi
host=$1
session="claude-$(whoami)"
exec ssh -t "$host" "tmux new-session -A -s '${session}'"