13 ms·
Mosh
- fooblat 7y agoI am also a fan of mosh. I really like that I can close my laptop and put it into standby, take it somewhere else with a different wifi network and just open it and get right back to work. From a user perspective it appears as if mosh was never disconnected.
- amingilani 7y agoYou can use tmux for persistence like that, and I use mosh in combination with tmux just because it's so nice to get multiple windows and panes.
- baq 7y agotmux solves a different problem - your session persists across disconnects, but you still have to reconnect and attach to the session manually. mosh is for low bandwidth high latency but as a side effect it makes the reconnect step transparent most of the time. (for the record i also use both mosh and tmux)
- opk 7y agoI mostly use mosh from my mobile for connections to home. It handles session persistence nicely even while on the move. It'd be great if I could use it now while working from home because my ssh sessions keep dying. Unfortunately the work firewall won't allow this. So tmux to preserve the sessions is the best I can do.
- steventhedev 7y agoI've used mosh extensively over the last few years with very few issues. It composes well with tmux. The only barrier to me really advocating it is the lack of support for bastion hosts and working around firewalls.
- AnthonBerg 7y agoI’ve used ZeroTier to solve most of that sort of network issues.
- donatj 7y agoEternal Terminal ‘et’ is like Mosh but functionally better. Doesn’t break scrollback. Transparent to tmux control mode. I switched from Mosh to et across 12ish servers around 6 months ago and am way happier for it. https://eternalterminal.dev/ https://eternalterminal.dev/ Previous conversation: https://news.ycombinator.com/item?id=21640200 https://news.ycombinator.com/item?id=21640200
- starfallg 7y agoLooking at Eternal Terminal, it doesn't have the same "local echo" feature that minimises the effect of latency in a cli environment. Thats the trade-off. The "local echo" feature is what I use mosh for as I deal with system 8 to 10 timezones away. Doing this breaks scrollback. I guess when mosh was first made, this was a problem with ssh shell sessions over EDGE or 3G as well, although network latency is less of a concern these days on 4G LTE or 5G mobile.
- sam_lowry_ 7y agoWhat about using GNU screen inside a mosh connection like that: mosh server -- screen -xRR -D You then can use the scrollback buffer provided by screen with Ctrl-a, ESC and then the usual Up/Down and PgUp/PgDown buttons.
- starfallg 7y agoYeah, I do something similar with tmux. You can even get mouse scrollback to work properly by setting the option in the conf file. Here some medium article about this - https://medium.com/@toja/tip-using-mosh-with-scrollback-257a54a848b3 https://medium.com/@toja/tip-using-mosh-with-scrollback-257a...
- londons_explore 7y agoFor some reason scrollback mouse integration works well till one disconnects and reconnects, and then suddenly it's broken.
- polote 7y agoAs someone who codes on a remote server the whole day, mosh is absolutely necessary and it is fantastic Advantages: - you dont see any lag when you type, it is exactly as if you were on your local machine - when network disconnect, the terminal freeze and when network is up again, the terminal becomes interactive again preserving everything in between - connection is preserved as long as the terminal is open, so even after hibernation your session is preserved Drawbacks: - you can't scroll , but if you use tmux then it is possible . I've tried using Eternal terminal, as it allows to scroll but it doesn't perform well at all on laggy connections - You can't detach and re attach mosh connections (same for ET) - I'm not sure it is possible to preserve middle-click copy/paste (at least I've not managed to make it work) - time to connect is a bit longer than normal ssh
- clarry 7y agoWhy do you code on a remote server?
- polote 7y agoI'm creating a PoC (well more the MVP of a company) and this includes a scrapper which requires a very reliable connection, which I don't have locally
- jsjddbbwj 7y agoThere are solutions to mount the remote filesystem locally and use any regular code editor
- clarry 7y agoThere are also editors that can use a plenty of various protocols to read & save remote files while performing editing locally.
- Piskvorrr 7y agoAnd most of them either rely on SSH+rsync, syncthing, or something along those lines - in other words, tools that will sync the files reliably, even on bad links...eventually. Never have I seen a backend that's built for editing...the remote-mount abstraction mostly works, but leaks specifically in these edge cases.
- colbertw08 7y agoIs Mosh being maintained anymore? I remember giving it an install maybe a year ago and remembering it didn't have any updates in quite some time.
- doubleunplussed 7y agoIt looks like there has been active development, but they haven't cut a new release. Reminds me of pyqtgraph, which gets commits most days last time I checked yet hasn't released since 2016.
- blunte 7y agotmux+mosh is a winning combination for working on remote servers. If you spend any time using a terminal to remotely manage servers, it's worth using at least tmux (and mosh because it provides a better experience with imperfect connections).
- globular-toast 7y agoI started using mosh a few weeks ago when I was working over ssh more. Even for working over LAN it was attractive because I'm really sensitive to typing latency. Don't be like the author and put off trying it, it's dead easy to install and try. No setup and no commitment to keep using it. However, I quickly ran into a problem which is that it breaks a scrollback. This is the one big problem with mosh and will probably never be fixed. I tried to find other ways but eventually decided I couldn't live with it. Shame.
- colordrops 7y agoLook into Eternal Terminal. It doesn't break scroll back.
- mprovost 7y agoTerminal emulators (xterm, iterm2 etc) are emulating something like a VT220 which were called "glass terminals" to differentiate them from earlier terminals which were keyboards attached to printers. So there's still this underlying concept of an endless spool of paper, and that's what you see when you scroll back. A scroll is literally a long piece of paper. Anyway that means if you cat some long file and then hit control-c, whatever was output before you aborted still has to be sent to your terminal emulator so it can write it to this paper (save it to the scrollback buffer). This sucks on a slow connection. mosh is running the emulator on the remote side of the connection and the client that you're interacting with locally just syncs periodically to whatever is currently being shown on the screen. So it doesn't have to send all of the output, which as you've seen, does break local scrollback. But it's a great solution for the problem it was designed to solve which is making terminals work over slow and/or unreliable network connections. If you pair it with gnu screen or tmux, then they become the terminal emulator and maintain the scrollback buffer, so you can still scroll back and see all of the paper. You just can't do it with the slider on your local window because your local emulator doesn't have access to the full contents of the buffer. I turn off scrollbars in rxvt and just rely on screen to maintain the buffer and use command keys to go back when I need to.
- Dylan16807 7y ago
- kbumsik 7y agoThe article misses the other great feature of Mosh: It never get disconnected, regardless of the client's state (IP address change, or device sleep mode), and you will never loose terminal sessions. When this is not so appealing to desktop users, it is a godsend feature for laptop/mobile users. Especially, if you are an iPad user you should try Blink shell app [1] with Mosh. This combination turns the iPad your favorite portable terminal machine. [1] https://blink.sh/ https://blink.sh/
- jefftk 7y ago(author) I was already using tmux for session persistence, so the local echo and handling of congested networks were the two features that made me wish I'd switched to mosh earlier.
- AdamGibbins 7y agomosh does persistence better, if you're connected to tmux over SSH it'll still disconnect as your IP changes on a roaming connection (like it does on my daily commute on the train). mosh does not, it stays no matter what. Also no need for autossh or similar to reconnect when you unsuspend your computer.
- twic 7y agoIt's even useful for desktop users if you are hopping off and on a VPN.
- oefrha 7y agoOf course there’s also the big problem of lack of scroll back in mosh as mosh actually handles the terminal emulation. I suppose this would be especially bad on an iPad with an on-screen keyboard, as the number of lines would be severely limited. How does Blink handle this problem? (I use Prompt 2 on my 12.9’’ iPad Pro which doesn’t support mosh. I only use mosh on computers with very high latency servers.)
- kbumsik 7y agoYeah, Blinks doesn't handle the scrollback problem neither. I always use a bluetooth keyboard when I connect the shell so I launch tmux inside of it, so I use tmux's scrollback feature. Besides I don't much need scrollback when I use iPad anyway. I have to admit that terminal is inherently not suited for touchscreen. Here I am suggesting iPad Pro a laptop alternative for a dedicated terminal use, where you use a physical keyboard.
- TickleSteve 7y agoUsed mosh to access remote linux machines over a sub-GHz IPv6 mesh. Since the mesh is UDP only, this provides a relatively normal shell experience for this type of situation. Works well.
- fluffything 7y agoYou need to install a server in the server for this to work. That is, if you are using SSH to log in to server farms as a "user" (as opposed to a server farm admin), then you cannot just "use mosh".
- maddyboo 7y agoWhen I first found out about mosh, I imagined it would work seamlessly even with servers that don’t have the mosh server installed by auto-installing itself. If mosh could do this, I would `alias ssh=mosh` and use it all the time. Otherwise I need to remember which servers have mosh installed, and for those that don’t I need to ssh in, apt-get mosh, disconnect, and reconnect with mosh. I’d imagine it could either just scp a binary over to the target system (in the case of insufficient privileges) or use the system package manager to install itself.
- fluffything 7y agoThat's supposing that you can run mosh in the background while you are not logged in.
- trevyn 7y agoMosh’s non-support of scrollback was always a deal-breaker for me. iTerm2’s tmux integration is pretty nice, though. Apparently there is iTerm2+tmux+mosh dark magic if one is into that kind of thing: https://www.gaeblogx.com/2017/10/09/Remote-Shell-Session-Setup/ https://www.gaeblogx.com/2017/10/09/Remote-Shell-Session-Set...
- tasuki 7y agoWell, tmux supports scrollback with `prefix [`, then `j` and `k` and `C^u` and `C^d` to move up and down, Enter to select and copy text. Not good enough?
- anthony_barker 7y agoI used it for a while - but was worried about security. Is it as hardened as ssh?
- tialaramex 7y agoMosh doesn't have to do the hard part. The difficulty is key agreement and authentication, but both those happen in SSH itself. So by the time Mosh is invoked you're definitely an authorised user and you and the server share a secret, so Mosh is just moving encrypted packets. It uses authenticated encryption, and I don't know much about the specific mode it apparently uses, OCB3, but in general there's just not that much to go wrong over and above all the work still happening in SSH.
- jwr 7y agoMosh is fantastic. And as an old-timer I am rather amused how some good ideas from a while back make its way into current hot tech again. After all, the IBM 3270 terminal was specifically designed to not transmit one character at a time. Thanks to this, a 1970s-era IBM 3033 mainframe fitted with only 16 MB of main memory was able to support up to 17,500 3270 terminals. (see https://en.wikipedia.org/wiki/IBM_3270 https://en.wikipedia.org/wiki/IBM_3270)
- JdeBP 7y agoTerminals in mosh are still fundamentally character mode, though. That's a fairly inescapable part of the POSIX general terminal interface. A better analogue for something where there's a block-mode send of form data is, ironically, a WWW browser and WWW pages with forms.
- rudiv 7y agoMosh has been a godsend while working from home the last few weeks. Especially because despite my company and all its employees being in India, we host all our servers in the US to 'keep up appearances'.
- prakashmahi 7y agocoolie no 1 movie 2020 cast and crew box office collection budget full story https://tezmovieswebsite.blogspot.com/2020/04/coolie-no-1-movie-2020-cast-and-crew-box-office-collection-budget-full-story.html https://tezmovieswebsite.blogspot.com/2020/04/coolie-no-1-mo...
- zxcvbn4038 7y agoMosh is awesome! The biggest issue I ran into was it being UDP based - lots of places lock down UDP even over VPNs - and if your client dies there is no way to reconnect. However as long as the client is active it is pretty bulletproof. Hopefully http/3 will cause people to loosen up UDP rules a bit.
- daveed 7y agoI'll just add that mosh is excellent. I started using it on a trip to the other side of the world. The ssh latency was terrible, and mosh saved the day.
- prussian 7y agoLast time I tried using things like this, it just ended becoming a VT layering monstrosity where you had like 3-4 terminal emulators all interfering with how you expect your keyboard and mouse interactions work. It's also why I gave up trying to use tmux. It's easier for me to just pick one terminal emulator I like and spawn multiple windows of it, ssh about and deal with the woes of TCP than put up with VT layering like mosh requires.
- turdnagel 7y agoIf you use a combo of iTerm on Mac + Mosh + tmux, I highly recommend rebuilding mosh on client/server from this PR[1] which adds better support for copy & paste. Also, if you use mosh without tmux, you're missing out -- learn tmux. [1] https://github.com/mobile-shell/mosh/pull/1054 https://github.com/mobile-shell/mosh/pull/1054
- larrywright 7y agoMosh + Blink (iPadOS) is a great combination.
- opwieurposiu 7y agoVS code remote works pretty well for this. Lag-free local editing of files, terminal is always there when you need it.
- deleted 7y ago[deleted]
- JdeBP 7y agoThe problem with mosh from my perspective has always been this sentence in the blurb: > This is accomplished using a new protocol called the State Synchronization Protocol, for which Mosh is the first application. This protocol has never been documented, making it "only" rather than "first", and once again putting the world in the position of one particular implementation's foibles being the only "specification".
- nightbrawler 7y agoMosh is awesome! I use it all the time to connect to servers over a slow and high latency satellite link. Highly recommend it for high latency connections.
- okhan 7y agoI used to live in SE Asia and was regularly SSH-ing into servers running in the US. The latency was awful. Mosh made everything far more pleasant. The only downside is that you have to install extra software server-side.
- alexhutcheson 7y agoIf you're an Emacs user (like the author apparently is), I would recommend trying out TRAMP: https://www.gnu.org/software/tramp/#Overview https://www.gnu.org/software/tramp/#Overview Emacs will transparently handle SSH connections and let you edit remote files as if they are local. Just as importantly, if you run commands like M-x compile or M-! (aka M-x shell-command) while you're looking at a remote file, Emacs will "do the right thing" and run the process on the remote machine, rather than on your local machine. This gives you the benefits that the author mentions about mosh - characters will appear as you type without waiting on a server round-trip. Additionally, you also won't have to wait for a server round-trip to see your cursor jump to the minibuffer, which the author mentions as a pain point. If you need to run things at the command-line, you can do so in a "shell" buffer via M-x shell (or M-x term if you need to run something curses-like). The major downsides: - I/O operations (including opening and saving files) can be much slower than if you were running Emacs in a terminal, because the bytes need to be sent over SSH. - It's not always easy to keep track of which buffers are "remote" and which are "local", so sometimes you'll run a command and it will run a process on a different machine than you expected.
- neurostimulant 7y agoI've been using Mosh for years and it's one of the first things I install on all servers I setup. I also install the client on my android phone via Termux and it's absolutely great on laggy and unreliable mobile connection. My only gripes are the lack of scrolling buffer (need to remember to use tmux) and the lack of support on iTerm's fancy tmux integration. Other than that it's an absolutely fantastic tool!
- nrmn 7y agoMosh is great, but it does not support port forwarding. For some people, including myself, this is a deal breaker. It has been an open issue/feature request since 2012[1] and even has a ~600 USD bounty on it[2]. [1] - https://github.com/mobile-shell/mosh/issues/337 https://github.com/mobile-shell/mosh/issues/337 [2] - https://www.bountysource.com/issues/4471419-ssh-port-forwarding-doesn-t-work https://www.bountysource.com/issues/4471419-ssh-port-forward...
- TTPrograms 7y agoI would also love this feature, but I understand the argument that it's major feature-creep for this project - as I understand, with mosh as implemented it would be difficult to integrate. IIRC they would have to roll some kind of TCP over UDP? I'm not sure, it's been a while since I looked at it. I'm willing to accept a good tool missing features over a poorly maintained tool that at some point had all the features I care about. And realistically $600 is a pittance compared to the long-term cost of maintaining a feature that has the potential to dramatically increase the size of the code base.
- shafte 7y agoEternalTerminal[1] was mentioned in a comment below. It supports port forwarding, and other goodies like native scrollback, at the cost of latency on laggy connections (because it doesn't do full terminal emulation). If that tradeoff sounds good to you, try it! [1] https://eternalterminal.dev/ https://eternalterminal.dev/
- FPGAhacker 7y agoI use mosh in tandem with tmux. About say 10% of my reconnects would fail with mosh, and the session would be orphaned. But combining with tmux, even if I lost the mosh session I could make a new one and reattach to tmux. My use case was iPad/iPhone remote working. (Usually while visiting in-laws or on a plane) Very intermittent connectivity. I used the open source blink terminal for iOS (which I bought because it’s great). It can use mosh.
- typon 7y agoDoes anyone know how to get mosh to play well with emojis or Unicode strings?
- Floegipoky 7y agoBig fan of mosh, I've used mosh + tmux + neovim for years