Hacker News new | ask | show | jobs
by ams6110 2920 days ago
Probably don't want to lose their ssh connections.
5 comments

Back in 2004 I had an ssh terminal open from my Mac (12" PowerBook) to my home Linux server. I closed the lid and took the laptop away with for a trip. For some reason I didn't use the laptop during the week. When I got back home 6 days later I opened the laptop and saw the ssh session. I tried it out and it still worked! I was amazed!

The ssh client had no keep alive. And the sshd had no keep alive. There was not firewall and a long DHCP lease. So it all just worked.

But because of firewalls aggressivly closing xonnections, these days we tend to need keep alives and so I don't this this would work today.

mosh doesn't support port forwarding. There is a $400+ bounty for the feature.
Great, they seem to have just solved `-R` (reverse) tunnels: https://github.com/MisterTea/EternalTerminal/pull/80
Link? I'll throw in $100 right now
I'm sure many people would appreciate that gesture

https://github.com/mobile-shell/mosh/issues/337

EternalTerminal does though, and it integrates better with tmux.
~$ 400 ? Not tempting at all.
If you have tmux or your remote machine, you can add this alias to your mac's bashrc

    alias my-server='ssh server-hostname -t "tmux new-session -s user || tmux attach-session -t user"'
It will connect to a tmux session on the remote machine if it exists or start a new one if it doesn't. If you Cmd+w your terminal window or disconnect, the tmux session stays running on the remote machine.

You could also tell it to try reconnecting every second and bind it to something easy to type like 'kj' (too bad df is already taken)

    alias kj='while true; do my-server; sleep 1; done'
There’s tmux, abduco, & screen for that on Linux.
mosh is an infinitely better user experience for certain use cases, particularly poor/intermittent connections. session establishment is very slow and requires a lot of round-trips, and if you have high latency and packet loss, it becomes painful. if you establish a session once with mosh, you don't have to establish connections after that, you just blit UDP packets.
mosh on its own doesn't handle scrollback buffer. So you're back to tacking on other things like tmux on top.
Those three are only neighbours to maintaining ssh connections problem.
You can run those on the remote side of the mosh session
Modern Standby/Connected Standby in Windows 10 won't lose any network connections while in standby.