project · January 12, 2021 · 2 min read
sshmux
A tiny tool that gives me persistent SSH sessions using tmux, so my connections to remote machines survive drops and long-running jobs keep going.
sshmux
I do a lot of my work on remote machines: EC2 boxes, my NAS, and whatever else I happen to be SSH’d into. The problem was the connection dropping on me. Between flaky wifi and my router’s dynamic routing, a long-running task would die halfway through just because SSH lost the link, and that got old fast.
Then I started using tmux on the server so sessions would survive, and somewhere along the way I saw someone suggest the obvious combination: why not wrap SSH and tmux together so the session is persistent by default? That was the whole idea behind sshmux.
Now I can run sshmux ec2-instance-far-away and get a stable, long-lived session
that reattaches itself if the connection drops. Long-running jobs keep running,
and I stop losing work to a dropped pipe.
How you can use it
Install it with Homebrew and point it at any host you SSH into:
1brew tap krushiraj/sshmux2brew install sshmux3sshmux your-remote-host
It is a small shell tool, so it is easy to read and tweak if you want to. The repo has the details.
