Sometimes I'm in someone else's networking environment and it's just not possible to get mosh working in a timely fashion. It would be great if I could still type mosh servername
in this case and still get things to work though, for muscle memory if nothing else! Right now, mosh will just fail, but it would be much better UX if mosh would detect this case, ssh into the machine, and print an error message. This would let me just use mosh all the time, for both home and work machines. There are periods of time where I have to just say, well I'm not going to use mosh this month, because I need to have a tool that consistently works and it's too frustrating to have this big 10 second workaround when I accidentally use mosh rather than ssh.
I'm reluctant to do this automatically, because starting an SSH connection where a Mosh session was expected could unpleasantly surprise people when the SSH connection dies.
Mosh master (and so mosh 1.2.6, when it appears) returns a non-zero exitstatus when Mosh session setup fails, which would allow you to create a wrapper script to do what you want. Does that help?
@cgull Yea, I understand this perspective. It's just that mosh isn't really usable when I can only get it set up on 50% of boxes in under 10 minutes. In my mind the better-than-autossh frontend,the text prediction, and the persistent server session are more important than the UDP performance optimization. But the UDP stuff really spoils the whole tool because it forces you to talk to the cranky networking people at your business.
Note: when falling back to ssh, you would have none the nice mosh features like text prediction. It will just be plain-old-ssh.
There was a similar issue to this in the past and somebody posted their gist for a mosh wrapper script that did the ssh fallback we would all like.
I tweaked it a bit and came up with this: https://raw.githubusercontent.com/sysadmiral/sysadmiral-puppet-control/localdev/site/users/files/amo/binfiles/mosh.sh
This let's me alias ssh to mosh.sh
and with the alias in place it even works with tools like clusterssh
.
Hope it helps!
A command line argument to fallback to ssh would be nice, it does not have to be default behavior.
Without the argument it would fail like today, with argument --fallback-to-ssh it would just print a warning.
Thanks for the wrapper script!
Most helpful comment
I'm reluctant to do this automatically, because starting an SSH connection where a Mosh session was expected could unpleasantly surprise people when the SSH connection dies.
Mosh master (and so mosh 1.2.6, when it appears) returns a non-zero exitstatus when Mosh session setup fails, which would allow you to create a wrapper script to do what you want. Does that help?