15 ms·
Mosh: The Mobile Shell
- dang 5y agoSome past threads: Blink Mobile Shell for iOS (Mosh Based) - https://news.ycombinator.com/item?id=18370348 https://news.ycombinator.com/item?id=18370348 - Nov 2018 (1 comment) Mosh: the mobile shell - https://news.ycombinator.com/item?id=12429203 https://news.ycombinator.com/item?id=12429203 - Sept 2016 (49 comments) Mosh: the mobile shell - https://news.ycombinator.com/item?id=11572146 https://news.ycombinator.com/item?id=11572146 - April 2016 (148 comments) Mosh – a robust, responsive replacement for SSH - https://news.ycombinator.com/item?id=8928506 https://news.ycombinator.com/item?id=8928506 - Jan 2015 (45 comments) Ask HN: Anyone using Mosh? Seems development has stalled since January - https://news.ycombinator.com/item?id=8556680 https://news.ycombinator.com/item?id=8556680 - Nov 2014 (1 comment) Mosh: A replacement for SSH - https://news.ycombinator.com/item?id=8252093 https://news.ycombinator.com/item?id=8252093 - Sept 2014 (122 comments) Mosh (mobile shell) - https://news.ycombinator.com/item?id=6321474 https://news.ycombinator.com/item?id=6321474 - Sept 2013 (6 comments) Mosh: the mobile shell - https://news.ycombinator.com/item?id=5016745 https://news.ycombinator.com/item?id=5016745 - Jan 2013 (89 comments) Mosh: the mobile shell - https://news.ycombinator.com/item?id=4588239 https://news.ycombinator.com/item?id=4588239 - Sept 2012 (1 comment) Mosh: SSH for 2012 - https://news.ycombinator.com/item?id=3819382 https://news.ycombinator.com/item?id=3819382 - April 2012 (193 comments) Mosh: the mobile shell - https://news.ycombinator.com/item?id=3814589 https://news.ycombinator.com/item?id=3814589 - April 2012 (2 comments)
- foxpurple 5y agoThe title “Mosh: SSH for 2012” is amusing because now in 2021, ssh is still king.
- blfr 5y agoSSH is great and full-featured, and mosh uses it for the initial connection, but try mosh if you haven't. I did years ago and never looked back. It reconnects immediately over any connection and works so well you can miss 15% packet loss. SSH feels so brittle next to it.
- input_sh 5y agoI disagree. SSH is fine for short connections (like git push or running some Ansible playbook), but it's far too fragile for longer uses. For example, if you're running something like dd with no output, you end up in a situation where you're not sure if dd is still running or did your connection just break. With mosh, I could start dd, close my laptop, move to a cafe, open up my laptop, and know for certain I'll re-establish the connection when I'm back online.
- gsich 5y agoIf you have long running operations you can use screen/tmux.
- Shish2k 5y agoYou can use screen/tmux, but they’re both more complicated and less good when it comes to this specific use-case. Personally I use both - mosh (or et) for the seamless automatic-reconnect, and tmux as a console window-manager.
- binkHN 5y ago> You can use screen/tmux, but they’re both more complicated... In what way are they more complicated? Granted screen is legacy, but tmux is just an executable on the server with sane defaults that Just Works OOTB.
- Shish2k 5y ago> In what way are they more complicated? When you change wifi networks you either have to remember to manually disconnect in advance, or wait for ssh to time-out the connection, then you have to create a new ssh connection, then you have to run an extra command to re-attach to the {screen/tmux} session you started earlier. It’s not insurmountably difficult work - but for the specific use-case of roaming across wifi networks, “doing a small disconnect and reconnect dance” with tmux is way more complicated and annoying than “open your laptop and all your connections are still working” with mosh.
- flyinghamster 5y agoIn general, I prefer SSH when using reliable, low-latency links, mainly because of the various forwarding capabilities (agent, X11, ports), and sometimes because I need my output to be sequential. But for any kind of situation where the link might be dodgy, mosh is king.
- eminence32 5y agoIndeed, a common paradigm is to use mosh to connect over the internet to some bastion host, and then use ssh for all subsequent connections over a highly reliable internal network.
- na85 5y agoI love mosh. It's great on slow connections of any sort, but particularly great on phones. On short/medium trips I no longer bring a laptop. Just my phone and my bluetooth keyboard. I have successfully updated my rspamd DKIM signing config from a hotel lobby, among other things, with just those devices and mosh. Mosh is great.
- themodelplumber 5y agoI'm curious, do you use any kind of terminal windowing, or what do you do about dividing up screen space / multitasking on your phone? This is one thing I really like on my laptop--multitasking with the side-by-side advantage, by keeping various windows visible at once, and using virtual workspaces with hotkeys assigned. Anyway, cool to read your endorsement.
- na85 5y agoI leave tmux running on my machines serverside, so it's a matter of: 1. Log in 2. $ tmux a 3. Continue where I left off. It's nice to have/annoying not to have more screen for doing real work. But if I'm traveling I'm not doing real work.
- fidelramos 5y agoPro tip: run ssh <host> "tmux attach || tmux" to have SSH automatically attach to an existing tmux session, or start a new one if there is no session.
- shp0ngle 5y agoNote that Mosh has not had release for 4 years, even when pull requests are accepted on github, and the team lead says "we are too busy/burned out". https://github.com/mobile-shell/mosh/issues/1115 https://github.com/mobile-shell/mosh/issues/1115
- eyelidlessness 5y agoAs someone over a year into a burnout... good for them for guarding themselves from overextending. Maintaining a project is hard even if you have the whole of your energy and attention to devote. It's a lot harder when you're trying to power through. I've held off finishing and releasing half a dozen projects over the last year because while I think they'd be useful I know I don't have bandwidth to support them.
- slg 5y agoI don't know how anyone could have avoided being in some stage of burnout over the last, let's say, 17 months.
- OtomotO 5y agoThe last 18 months were the best of my life. Not looking forward to what the majority calls "normal"
- eyelidlessness 5y agoI assume this means you’re working remote and it benefits you? If so, that’s awesome and it should be accommodated! Edit: I take that (assume) back and wonder if there’s other social benefits you’ve gotten from isolating regardless of work conditions. I also support that if so!
- eyelidlessness 5y agoI don’t disagree at all! But let’s just say I’m waiting out a severance contract before I talk in more specifics about mine because damn.
- codesections 5y agoI know the pace of development has been pretty slow for the past few years — but Mosh is a good enough idea that I really hope it picks up steam again (better true color support, for one thing, would be a big feature)
- anamexis 5y agoAgreed, I think it's an already-fantastic tool that is a bit of polish away from being perfect. My number one gripe is the lack of scrollback.
- Teknoman117 5y agoMosh is the only reason I can bear working over a satellite internet connection. The local echo is fantastic. It's also fantastic for working over VPN connections where the tunnel collapses occasionally and you don't want to lose 30 active sessions.
- emersonrsantos 5y agoThis mimics a lot how 3270 devices work, by transmitting chunks instead of individual keystrokes. The IBM 3270 technology dates from 1970!
- tyingq 5y agoSort of. Local echo and "smart current line editing" aren't quite the same as block mode, forms, etc. To me, a html form is closer to what 3270 is.
- flyinghamster 5y agoTo me, conceptually, mosh is more like "VNC for character terminals." Overall, I think it's a brilliant solution for terminal sessions over links not intended for terminal sessions.
- est 5y agoAll I need is file transfer.
- doomrobo 5y agoBig fan of Mosh for what it does. But the fact that it can't render Unicode properly makes it really hard to work with some files remotely. IIRC there's a PR that fixes and has never been merged
- wirthjason 5y agoI always want to try alternative shells but I always come back to bash. I think Fish had the longest residency. I have yet to find the killer reason to never come back. It’s a bit like programming languages. So much cool stuff out there but it’s hard for me to leave Python. Like Bash, everything works with it. I’m curious what people’s “killer apps” are for permanently changing shells.
- arsome 5y agomosh isn't an alternative shell, it's sort of like "rsh" or "ssh" except designed for mobile... and using SSH for authentication and session setup.
- edgyquant 5y agoI have this same problem. I’ve tried fish and zsh but all my scripts are in bash and over the years I’ve honed an environment I can just git clone to any Linux machine and it works
- zelienople 5y agoMobile yes; portable no. For bonus points, make it an actually portable executable. Then we'll be getting somewhere.
- perryizgr8 5y agoI found et which works better than mosh in some respects. It supports scrolling, and seems faster to respond.
- rattray 5y agoLink? Any tradeoffs?
- banana_giraffe 5y agoThey're talking about Eternal Terminal, I think https://eternalterminal.dev/ https://eternalterminal.dev/ I'd be curious about the trade offs too, I'll have to check it out.
- perryizgr8 5y agoIt works in identical fashion to mosh. I don't see any trade-offs except: 1. et has scrolling support 2. et does not have local echo of your input like mosh does Edit: The comments below do a very good job of explaining the differences. TIL.
- jclulow 5y agoI don't believe it's identical at all. Eternal terminal is a TCP-like abstraction that adds another layer of tracking and acknowledgement so that the reliable ordered byte stream can be reconnected and resumed. Mosh is more like a video codec mixed with a terminal that knows how to do limited, speculative local echo that gets subsequently corrected once the display round trip is complete. They're fairly different in approaches. For example eternal terminal has to send all of the bytes in order, so more output requires more bandwidth. Mosh only has to redraw bits of the frame that have changed, at a presumably adaptive rate -- you could scroll a hundred megabytes of text by really quickly, but only need to send a few screen-fulls of updates, which is of course why it doesn't allow for regular terminal scrollback.
- vmladenov 5y ago
- bombcar 5y agomosh is basically a proof of concept as a college project - it is missing Unicode and ssh-agent forwarding which may be significant for some. Otherwise it works decently well for what it does. For many screen and normal ssh will do the job.
- na85 5y agoIt's the tragedy of open source. Lots of times, the software used by hundreds of FAANG developers is maintained by a single overworked developer in their spare time. If I could get paid to work on mosh I would.
- keithwinstein 5y agoHow much do you want? We'd very much welcome your involvement -- we'd love to have you start helping out in the IRC channel, help us put together a credible plan for the next release (probably helping the current maintainers), and let's talk.
- na85 5y ago>How much do you want? Wait, does mosh have financial backing? Because I was only partly being facetious because I assumed it was an unsponsored project. I'll join IRC :)
- keithwinstein 5y agoRe: Unicode, please see https://news.ycombinator.com/item?id=28151652 https://news.ycombinator.com/item?id=28151652. (Mosh really just uses your C library for knowing the width of characters -- if the server's and client's libc support a character, Mosh will too. Unfortunately Apple in particular has historically been not super-great about keeping theirs up-to-date once Unicode went to an annual release cycle. screen and tmux have similar issues and basically ship their own Unicode tables, which has its own problems.) For ssh-agent forwarding, most people are using https://github.com/StanfordSNR/guardian-agent https://github.com/StanfordSNR/guardian-agent which is more secure than traditional agent forwarding, and works with SSH or Mosh.
- jacob019 5y agoI typically use ssh over wireguard and tmux if I need persistent sessions. Wireguard takes care of the unstable remote link and changing IPs. I can suspend my laptop on one connection, wake it up later on another and still have an active session. I use openssh via Termux for the client on Android or whatever terminal emulator on the laptop. Can mosh offer me anything?
- foxpurple 5y agoMosh apparently fixed the lag issue where typing is very slow on far away servers. Trying to ssh a server on the other side of the world is annoying.
- chousuke 5y agomosh has very good latency hiding and your connection can actually be interrupted for longer than a TCP session would tolerate. The latency hiding alone makes it worth it; SSH is miserable over links with any lag, mosh feels as responsive as typing locally until you get into hundreds of milliseconds of latency.
- Jtsummers 5y agoMy setup is iPad + MBP + Linux server. I use mosh to connect, also with a Wireguard VPN, and have tmux running on the server. It's very convenient to pop open Blink on my iPad and have everything right where I left it (modulo changes made while on the MBP) and the reverse when I pull up the terminal on my MBP. The main benefit for me is mobility, though, not the restore from sleep itself. When I started using this setup I was traveling quite a bit, including just locally (living in a downtown area, I'd start on something in the apartment, then decide to go to the coffee shop, or the growler place, and continue working). Not having to reestablish the connection (even using SSH certs that's still some friction) was very pleasant. The second is when dealing with an unreliable network. Though this is less common these days, when I started with it I had a lot of issues in my apartment thanks to a neighbor with a noisy microwave oven.
- narraturgy 5y agoCan you speak to the experience of coding on the iPad? I have been considering picking one up for personal reasons but the price seemed prohibitive when I thought it simply could not be used for portable work purposes at all.
- keithwinstein 5y agoMosh original author here -- fun to see us back here yet again. Happy to answer any questions.
- na85 5y agoAre you planning on addressing some of the long-standing issues relating to e.g. Unicode rendering?
- keithwinstein 5y agoPlease see https://news.ycombinator.com/item?id=28151652 https://news.ycombinator.com/item?id=28151652 , but happy to discuss further if you want.
- diekhans 5y agoAll I can say is THANK YOU!!! I use mosh 10+ hours a day. Maybe it needs a bit of help, but it is in my top 10 of "how did I accomplish anything with out mosh.
- arthurcolle 5y agoSyntax error, unterminated delimiter: "
- nmstoker 5y agoIt looks like there's no sponsorship for Mosh. Had this been considered? Not saying money would solve the challenges the maintainer faces but there might be things it eases. With a tool this popular I expect it wouldn't struggle to raise a fair bit.
- eminence32 5y agoI don't think it's been considered. To be honest, sometimes adding money to a development projects makes things worse. It can sometimes introduce new unwanted obligations that weren't there previously.
- technofiend 5y agoMosh is perfect for ephemeral client connections to a long-standing session. My ipad likes to kill ssh sessions every time the screen locks. But using mosh insulates me from that and I just go back to a hot shell with no interruption.
- d4l3k 5y agoAdding port forwarding to Mosh has a $600 bounty -- highest OSS bounty I've ever seen https://www.bountysource.com/issues/4471419-ssh-port-forwarding-doesn-t-work https://www.bountysource.com/issues/4471419-ssh-port-forward... https://github.com/mobile-shell/mosh/issues/337 https://github.com/mobile-shell/mosh/issues/337
- retrir 5y agoOn high bounties, Qubes OS has a $6500 bounty for GNOME support https://www.bountysource.com/issues/31778112-add-support-for-gnome-in-dom0-gui-domain https://www.bountysource.com/issues/31778112-add-support-for...
- gnyman 5y agothere is a fork with port forwarding support https://github.com/rinne/mosh https://github.com/rinne/mosh and a PR with a long discussion https://github.com/mobile-shell/mosh/pull/696 https://github.com/mobile-shell/mosh/pull/696 on why it's not merged you can compile them yourself or if you want to skip the step I recently set up GitHub actions to compile linux binaries of this [1][2], tested by a sample of 1 so no guarantees it works, was planning on doing a tap PR/tap of it at some point also the official developers have been involved a project to solve this while improving the whole-agent approval things also https://github.com/StanfordSNR/guardian-agent https://github.com/StanfordSNR/guardian-agent , but I couldn't get it to work which is why I tried the fork and got that working [1] https://github.com/gnyman/mosh/actions/runs/1068715036 https://github.com/gnyman/mosh/actions/runs/1068715036 [2] https://github.com/gnyman/mosh/actions/runs/1068715035 https://github.com/gnyman/mosh/actions/runs/1068715035
- codetrotter 5y ago> a PR with a long discussion https://github.com/mobile-shell/mosh/pull/696 https://github.com/mobile-shell/mosh/pull/696 on why it's not merged I'm confused. I read the whole thing but couldn't find the specific reason for why it's not been merged. But I assume it's because of the things that were pointed out in the code review comments? Also, the issue you linked is about SSH Agent forwarding, not port forwarding.
- yoavm 5y agoLove mosh, back when the connection was bad I had it aliased to ssh. Somewhat relevant: if you actually a need to take your shell mobile, check out my tmux plugin that allows you to quickly transfer your tmux session to your phone without any app, using websockets and a QR code: https://github.com/bjesus/muxile https://github.com/bjesus/muxile
- ifa_ 5y agoi just switched to et
- voxadam 5y agoEternal Terminal (https://eternalterminal.dev/ https://eternalterminal.dev/)
- news5780 5y agoalso interested in trying et because some of my networks block udp..but i’m worried about its security
- Per_Bothner 5y agoMaybe try DomTerm (https://domterm.org/Remoting-over-ssh.html https://domterm.org/Remoting-over-ssh.html) - it uses plain ssh on port 22. (See separate response.)
- gorgoiler 5y agoLocal echo always felt like a handy feature for any kind of laggy terminal app, not just ssh / mosh. I imagine such a tool would emulate a terminal a la screen / tmux, and just print what you type until the underlying program outputs to stdout, at which point it undoes what you typed and replays the stdout? I realise I may be betraying a complete lack of understanding of how Unix terminals actually work :) Is there a Unix utility that implements a local-echo wrapper?
- tmsbrg 5y agoHmm, rlwrap[0] is a really nice tool when working with applications that are poor at handling terminal input. It basically handles your keystrokes in rlwrap and whenever you type enter it will send the input line to the application to handle. It's very useful also for application that don't have their own input handling (arrow keys, etc.) or have extreme keystroke latency. It will even give you ctrl+r feature to search commands you typed earlier. I use it often for pentesting when getting a raw reverse shell. I'll get access to a remote bash session through netcat, and using rlwrap I can do the line editing locally and find the complex commands I've written before without copypaste. [0] https://linux.die.net/man/1/rlwrap https://linux.die.net/man/1/rlwrap
- Johnny_Dear 5y agoTest
- larodi 5y agobeen expecting for a native windows of the tool for some while, pity that there is none. apart from that - it works like charm indeed.
- LAC-Tech 5y agoI use this for my VPS which is a 4 hour plane journey from me. It's a lifesaver. Mosh really is an un-sung hero when it comes to software. Especially for those of us in the middle of nowhere :)
- notorandit 5y agoIt's a neat solution, indeed. But is that actually viable and useful? Not sure. First, you need to open firewalls to UDP port ranges. Second, you still need SSH to be in place and reachable. Third, as soon as you kick off mosh you loose all bells and whistles by SSH (like TCP forwarders, SOCKS proxies etc.). So my idea is: nice for amateur small infrastructures, pretty useless for real world (cloud) infras. Maybe you can make mosh-reachable a bastion or two, but no more than that. Nonetheless, i stress, it's a neat idea.
- deleted 5y ago[deleted]
- treesknees 5y agoNot useless, you just need to think about how to use the tool in a different way. I use mosh to login to a stable jump box and then from there use tmux/ssh to branch out all my sessions to cloud infrastructure or other devices that only accept ssh.
- notorandit 5y agoThat's the "bastion" concept. But then you loose all the extra perks sshv2 offers.
- flyinghamster 5y agoTrying to use SSH via LTE over a mobile phone hotspot was downright horrible. It took ridiculous keepalive settings and a separate window pinging the destination to make it even halfway usable. Then someone on another HN thread mentioned mosh. That was just what the doctor ordered. It's something I've wished I knew about years ago, given that it's also useful when Wi-Fi gets dodgy.
- linsomniac 5y agoI've been watching mosh for years, but I kept running into some sort of environment/locale issue that was getting in the way. Finally, a couple months ago I got "Linux (Beta)" available for my Chromebook and switched to using it rather than a Chrome SSH plugin to login to my work computers. I started up mosh and it's been glorious! I used to have to reconnect every time my chromebook went to sleep for any length of time, but now I've had a single session open for ~6 weeks. It has a nice banner when it loses connectivity, so I immediately know there are network/VPN issues. I don't love the "Control-^" escape key, because it interferes with "Last buffer" in vi, but otherwise it's worked flawlessly. A decade or so ago I pointed a client at mosh, he had a rural property with satellite Internet and he managed a bunch of other peoples computers. He was overjoyed with mosh!
- eminence32 5y ago> I don't love the "Control-^" escape key, because it interferes with "Last buffer" in vi, but otherwise it's worked flawlessly. In case you didn't know, you can change the escape key to something that fits better for you. See the mosh man page (MOSH_ESCAPE_KEY).
- Per_Bothner 5y agoDomTerm has nice remote-terminal solution: https://domterm.org/Remoting-over-ssh.html https://domterm.org/Remoting-over-ssh.html . Compared to mosh is supports a much more complete xterm-like terminal, full scrollback, runs on Windows (using WSL), does not require superuser/admin access (runs on top of plain ssh), has an integrated tmux-style multiplier, and is actively developed. Like mosh it has predictive echo, and detach/attach. It also has an optional local-input-edit mode (used by default if the remote terminal is in icanon mode). An easily-installable AppImage is available (https://github.com/PerBothner/DomTerm/releases https://github.com/PerBothner/DomTerm/releases). Feedback welcome.
- flaxton 5y agoBeen using mosh for years now, couldn’t imagine working without it!