Hacker News new | ask | show | jobs
by kstenerud 2808 days ago
I'm not sure if I missed something? Normally I use -L syntax for tunneling (-L local_port:remote_addr:remote_port). Does this tool do more?
6 comments

I don't think i've missed anything, it does the same thing as ssh -L with slightly different syntax.

It's the same with mosh. Normally i use tmux on the destination host, and i simply cannot see any reason to use mosh over ssh/tmux.

> i simply cannot see any reason to use mosh over ssh/tmux.

How about automatic session resumption and predictive character insertion to improve typing when under latency?

Since mosh relies on UDP, it's completely useless for folks who are behind proxies (e.g. for work, school, etc)
session resumption:

    tmux a
As for predictive character insertion, when i'm working in a shell, especially with high latency, i prefer my commands to be as i type them, not something some algorithm "guessed" i was going to type.
That's not what mosh is, it doesn't predict what you're going to type. It however proactively renders the characters you type before it receives confirmation from the tty on the other end.

In other words, imagine typing ssh somebox.typo.com and waiting 1 second before the text renders and discovering the typo, then pressing backspace, waiting a while for the backspaces to render, then going through all of this again. With mosh you'll be able to instantly see what you typed and fix it. On high latency connections it makes a huge difference in quality of life.

> It however proactively renders the characters you type before it receives confirmation from the tty on the other end.

Basically for those with experience of text terminals genrally: local echo.

I worked as a sysadm at at "large" (local scale) UNIX SysV installation back in the early 90s.

Everything there connected via serial ports, remote offices got multiplexed over a 9600 baud connection. Back then we had local echo for the sometimes slow link, i.e. printing a spreadsheet converted to 3Mb PostScript, and still only 9600 baud in total.

So i know what local echo is. It has nothing to do with prediction :)

I'm still not convinced about mosh, but it sounds like it really does help a lot of people, so who am i to judge. I guess i'm privileged since i don't usually experience latency. We have about 95% 4G coverage in this country, coupled with fiber connections.

The last time i experienced any noticeable latency was when editing files on a clients SCO OpenServer across The Atlantic Ocean over a 1200 baud connection.

Mosh support roaming and intermittent connectivity which is really super useful if you have to debug a server on a very dodgy 3g connection in a moving train.
I just learned about mosh, ty. I use SSH sessions all the time and sometimes over satellite links.
You should run tmux or screen inside it anyway. There's no way to reattach to a broken mosh session, as happens if you close the local terminal.
tmux solves the session resumption at a lower level. You can have a connection from home, jump on a train, open your laptop and keep typing and do the same when you get into the office. You don't need to re-auth each time (or deal with delayed disconnects).

It works well WITH tmux, not instead of tmux.

Which means your solution would be something like:

  while true; do
    ssh -t ${HOST} tmux a
  done
But that lacks the other benefits, especially having to wait for the session to timeout.. Take a look at: https://en.wikipedia.org/wiki/Mosh_(software)#Performance
It doesn't guess. It sinoly has local echo, and the characters that are not-yet-ack'd are underlined. Changes your life when working with 175ms+ latency
I don't think you missed anything.. I'm pretty sure I've seen a few similar apps like this on HN, but I don't really understand the draw of them over just using ssh's built in options.. You can even configure tunnels in ~/.ssh/config for "aliases".
I don't know if it does but I kind of assumed/hoped it did reconnect if a connection drops. But I can't find anything about it so I guess it doesn't.
Uh. I run an autossh program on the host in question. It auto-runs ssh connections when they drop, including tunnels.

https://www.everythingcli.org/ssh-tunnelling-for-fun-and-pro...

there's multiple ways to make tunnels in ssh. -L is one of them (local forwarding). basically, local, remote and dynamic forwarding are possible. there's some interesting uses for the latter 2 as well so if you only know -L it might be nice to check out the other methods and how you can use those. You can for example, forward a remote localhost port of a server to your own localhost, and then have a fully encrypted channel to some internal or locally bound service. for example if some server hosts a site on it's loopback or some service is listening there which you want to interact with, then you can do it directly from your own machine instead of through an active ssh session. (for example with websites this is useful, because then you can have a graphical browser instead of links via ssh x11 forwarding or w/e)
Thank you for the feedback. Much appreciated.

Someone else opened an issue requesting that: https://github.com/davrodpin/mole/issues/22

It can bind to a local available port without having to specify what it is. Stops port clashes.
The tool can select the local port on your behalf.

It also has aliases to store configuration that user usually use, but that is comparable to the ssh config file.