News for hackers. Stuff that matters.
Re:Mosh: A replacement for SSH by sagichmal on Monday September 01, 2014 @05:36AM (#8252137)
Mosh is brilliant software. I use it every day. Being able to close my laptop, move to a different café, and open it back up with all of my sessions seamlessly reconnecting is invaluable.

But -- mosh still can't do proper SSH agent forwarding[0], which is a real drag. Many of my common workflows become impossible. I hope it gets fixed!

[0] https://github.com/keithw/mosh/issues/120

Re:Mosh: A replacement for SSH by quotemstr on Monday September 01, 2014 @05:40AM (#8252148)
I feel like mosh is fixing problems at the wrong layer. Instead of making application protocols connectioness, we should make Mobile IP work so that connections don't need to be broken in the first place, or, failing that, separate the protocol management from the session persistence system.

Combining regular ssh with screen has worked fine for me for years. Why would I want to switch to something with a much shorter track record for security?

(By the way: if you want a line-buffered ssh for use over bad connections, run ssh inside Emacs with M-x shell.)

Re:Mosh: A replacement for SSH by rakoo on Monday September 01, 2014 @08:02AM (#8252441)
> we should make Mobile IP work

Unfortunately we have very little chance of having an impact on how ip is implemented in mobile network, but we do have the possibility to change our softwares to accommodate deficiencies. Much like HTTP over SPDY is highly similar to HTTP over SCTP, but we have much more chance in making SPDY a reality rather than SCTP.

> Combining regular ssh with screen has worked fine for me for years.

I guess the real novelty (and it's too bad it isn't presented in greater depths) is SSP, the synchronization protocol. It can be an inspiration for other network programs.

Re:Mosh: A replacement for SSH by therealmarv on Monday September 01, 2014 @06:27AM (#8252247)
Thank you for the tip with "screen"! I was aware of MOSH but did not know about screen oO. Is there any other line-buffered ssh which does not require Emacs?
Re:Mosh: A replacement for SSH by nolok on Monday September 01, 2014 @07:34AM (#8252385)
If you do not know screen, then tmux is going to blow your mind
Re:Mosh: A replacement for SSH by matthiasv on Monday September 01, 2014 @08:19AM (#8252484)
If you do know screen, then tmux is going to blow your mind.
Re:Mosh: A replacement for SSH by jnbiche on Monday September 01, 2014 @08:46AM (#8252561)
Well, this is probably as good a place as any to ask a tough TMUX question I've had for several years. I love TMUX, but whenever I'm working with protocols or anything binary, if I accidentally push any binary out of stdout, it corrupts the display, and the only way I've figured out how to fix this once it's happened is to totally restart TMUX.

Does anyone know how to fix this?

(don't usually ask SO questions on HN but this has been bugging me for years)

Re:Mosh: A replacement for SSH by jdelStrother on Monday September 01, 2014 @11:57AM (#8253459)
'reset' might work, but often when this happens to me, it's because the window's name has been changed to something ridiculous. Hit "<prefix>," and rename your window back to something sensible.
Re:Mosh: A replacement for SSH by jnbiche on Monday September 01, 2014 @10:26PM (#8255540)
'reset' combined with renaming the window may just work. Thanks for everyone's input!
Re:Mosh: A replacement for SSH by fmoralesc on Monday September 01, 2014 @09:23AM (#8252669)
Tried 'reset'?
Re:Mosh: A replacement for SSH by marcosdumay on Monday September 01, 2014 @09:12AM (#8252637)
I have very litle experience with TMUX... But you can try runnng the "reset" command. It resets the TTY, if TMUX does not use any crazy magic it should work.
Re:Mosh: A replacement for SSH by cel1ne on Monday September 01, 2014 @09:44AM (#8252764)
lesspipe [0] might fix your problem to some part.

[0] http://www-zeuthen.desy.de/~friebel/unix/lesspipe.html

Re:Mosh: A replacement for SSH by JoshTheGeek on Monday September 01, 2014 @12:32PM (#8253642)
Kill the pane (prefix x) and then run `reset`, maybe?
Re:Mosh: A replacement for SSH by rezacks on Monday September 01, 2014 @09:56AM (#8252809)
tmux is awesome indeed!
Re:Mosh: A replacement for SSH by Ecio78 on Monday September 01, 2014 @07:46AM (#8252409)
Check also tmux as screen alternative
Re:Mosh: A replacement for SSH by morsch on Monday September 01, 2014 @06:21AM (#8252231)
Yes. I was wondering, faced with an unreliable on-train mobile connection, is there any existing way to improve the content delivery by using a proxy host?

It seemed to me as if the mobile browser kept redoing a whole lot of work, ie. essentially re-requesting web sites from scratch. I'd like to make a single request to a web site, have my proxy host complete the request and deliver the bytes piecemeal to the browser as I go in and out of range.

I think it's possible to do this transparently to the browser, but I think you might need a proxy host with a reliable connection as well as a proxy software running on the mobile device that can deal with the situation by telling the reliable host: I'm back, here's a list of running requests and the last byte I received, please continue.

Re:Mosh: A replacement for SSH by rakoo on Monday September 01, 2014 @12:44PM (#8253703)
He was mocked, but he was anticipating it: Stallman sends an email to a daemon that fetches the pages for him (https://stallman.org/stallman-computing.html)

> I generally do not connect to web sites from my own machine, aside from a few sites I have some special relationship with. I fetch web pages from other sites by sending mail to a program (see git://git.gnu.org/womb/hacks.git) that fetches them, much like wget, and then mails them back to me. Then I look at them using a web browser, unless it is easy to see the text in the HTML page directly.

Re:Mosh: A replacement for SSH by kyrra on Monday September 01, 2014 @07:13AM (#8252341)
I believe this is how the opera browser for ios works, or amazons browser for their fire tablet.
Re:Mosh: A replacement for SSH by Piskvorrr on Monday September 01, 2014 @08:47AM (#8252562)
Alas, both of them are proprietary and monolithic - IOW, you can only use the infrastructure iff you're also using the one specific client. Not very useful for extending even for other browsers, or even different protocols - which is a pity :(
Re:Mosh: A replacement for SSH by jdong on Monday September 01, 2014 @01:44PM (#8253943)
Lynx over mosh?
Re:Mosh: A replacement for SSH by boomlinde on Monday September 01, 2014 @11:40AM (#8253357)
> we should make Mobile IP work so that connections don't need to be broken in the first place

A lot of the problems with mobile networking are the results of connections literally being cut off. On trains I often end up without coverage (tunnels, in the middle of nowhere) exactly for that reason; the connection broke. I don't think that hacking a system based on connections to pretend that this never happens is a particularly good idea.

Re:Mosh: A replacement for SSH by takeda on Monday September 01, 2014 @08:19PM (#8255186)
There are already some solutions for this (and other problems). For example [NDN](http://en.wikipedia.org/wiki/Named_data_networking) which was designed based on today's Internet usage pattern.

The major problem with it is that existing protocols need to be reinvented once again to fit new way of communicating. Of course you could encapsulate TCP/IP over it, but then you're losing all nice properties of the protocol.

Re:Mosh: A replacement for SSH by e40 on Monday September 01, 2014 @10:32AM (#8253004)
Combining regular ssh with screen has worked fine for me for years.

This doesn't work for me because I use emacs over X11 over a tunnel.

mosh doesn't work because I feel required to use ssh-agent. That is, I feel required to use a password on my ssh private key and not using ssh-agent is too high a burden.

Re:Mosh: A replacement for SSH by fahadkhan on Monday September 01, 2014 @11:36AM (#8253340)
Have you tried xpra?
Re:Mosh: A replacement for SSH by gglitch on Tuesday September 02, 2014 @11:09AM (#8257976)
I run ssh inside emacs, and I also leave emacs running in server mode on my targets. I drop my signal, no big deal; I reconnect and reattach to emacs. No fuss, no muss, no lost work. It then becomes immense that I can do almost everything in emacs :)
Re:Mosh: A replacement for SSH by sandstrom on Monday September 01, 2014 @10:34AM (#8253016)
Although I like mosh, I agree that fixing this at a lower level would be better.

What do you think about Multi-path? I think Apple is already using it for Siri.

http://tools.ietf.org/html/rfc6824.html

Re:Mosh: A replacement for SSH by rweir on Monday September 01, 2014 @06:24AM (#8252240)
> I feel like mosh is fixing problems at the wrong layer. Instead of making application protocols connectioness, we should make Mobile IP work

I look forward to using regular SSH to connect to my servers hosted in the floating city of New Chicago!

Re:Mosh: A replacement for SSH by quotemstr on Monday September 01, 2014 @08:36AM (#8252530)
I'm still optimistic that we'll support RFC 6275 before we're all dead.
Re:Mosh: A replacement for SSH by Piskvorrr on Monday September 01, 2014 @08:48AM (#8252564)
I for one hope that I won't need to support it after I'm dead.
Re:Mosh: A replacement for SSH by anonbanker on Wednesday September 03, 2014 @12:13PM (#8263704)
Let's assume for a moment that RFC6725 is implemented in pacemakers or artificial organs. How long after death would/should these devices remain active? could we use Mobile ipv6 to communicate with the recently-departed loved ones to send final well-wishes?
Re:Mosh: A replacement for SSH by Piskvorrr on Thursday September 04, 2014 @04:55AM (#8267275)
Let us assume the moon is made of cheese. Now let's discuss the feasibility of a cheese-mining colony there.

I, for one, look forward to communicating with a deceased person's gallbladder.

Re:Mosh: A replacement for SSH by anonbanker on Thursday September 04, 2014 @05:07AM (#8267297)
https://warosu.org/data/vr/img/0014/96/1395782839524.jpg

Perhaps replying with a non-sequitor is why you were downvoted?

Re:Mosh: A replacement for SSH by Piskvorrr on Wednesday September 10, 2014 @05:49AM (#8295759)
In other words, perhaps more seriously: If your initial assumption doesn't make sense, then the whole argument is nonsensical.
Re:Mosh: A replacement for SSH by anonbanker on Wednesday September 10, 2014 @12:45PM (#8297464)
Maybe you can explain why implementing RFC6725 in pacemakers and other artificial organs doesn't make sense?
Re:Mosh: A replacement for SSH by Spooky23 on Monday September 01, 2014 @09:32AM (#8252716)
It's not going to happen, especially in mobile.

ISPs like Verizon Mobile are NATing everything -- even IPv6 IPs, and running through proxy servers to enable rate-limiting and other things.

Re:Mosh: A replacement for SSH by quotemstr on Monday September 01, 2014 @10:46AM (#8253079)
There is no reason that traffic shaping should require NAT.
Re:Mosh: A replacement for SSH by andreasvc on Monday September 01, 2014 @12:04PM (#8253489)
"One IP per customer" makes accounting and bandwidth capping much easier.
Re:Mosh: A replacement for SSH by simoncion on Monday September 01, 2014 @01:20PM (#8253852)
"One IPv6 /64 per customer" works just as well, no?
Re:Mosh: A replacement for SSH by teddyh on Monday September 01, 2014 @07:41AM (#8252395)
(If all you’re using M-x shell for is to run SSH, it makes more sense to run M-x eshell, since that doesn’t waste a process for a subshell.)
Re:Mosh: A replacement for SSH by pseudonym on Monday September 01, 2014 @06:29AM (#8252254)
If your workflow doesn't include tmux or screen, then I feel like your problem's already been answered. If you really wanted to, you could just add a "/bin/screen -DR; exit" to your remote .bashrc and the screen integration would be completely invisible after the initial instantiation.

As far as mosh is concerned, it feels like it's an extremely overengineered solution to the "I wish I had started this process in a screen session" problem, except you need to be thinking even further ahead than you would normally (installing and connecting via a mosh service, as opposed to remembering to connect to a screen session that can be run with very little prior setup and no client modification).

Re:Mosh: A replacement for SSH by dedward on Monday September 01, 2014 @10:29AM (#8252983)
While the situation you describe is one that some people end up using it for - it's not the real reason mosh is useful.

Where mosh really shines is when your IP is changing too frequently (a mobile problem when you are on the move) and when you are dealing with high latency connections.

When you have to ssh in somewhere over a shitty, barely working mobile data connection - mosh is a lifesaver. It makes an otherwise unusable situation comfortable and productive.

Sure, it's handy for jumping between connections, on/off wifi and so on - but that's easy to achieve many other ways with tools that have been around for a decade or two at this point.

Re:Mosh: A replacement for SSH by p4bl0 on Monday September 01, 2014 @06:44AM (#8252281)
> solution to the "I wish I had started this process in a screen session"

Not necessarily. When I'm thethering my phone's data connection to my laptop I use mosh to ssh into my server because it resists way better to bad connectivity. No matter if I used screen or not, I would still have to kill the ssh process and connect again and reopen screen if I didn't use mosh.

Re:Mosh: A replacement for SSH by gnufied on Monday September 01, 2014 @06:35AM (#8252262)
I have been using Screen for years. Will Screen attempt to reconnect to a remote SSH session? I think what `screen -DR` will do is - it will automatically connect me to a screen session `after` I login to the remote machine.

But if I lost connectivity - my SSH session won't be auto-resumed from local machine in first place, I think thats one of the things `mosh` solves.

It promises lower latency etc, but I am just perhaps too slow to notice such things (or both SSH/Mosh feel equally laggy if remote connection is slow enough).

Re:Mosh: A replacement for SSH by pseudonym on Monday September 01, 2014 @07:28AM (#8252375)
>But if I lost connectivity - my SSH session won't be auto-resumed from local machine in first place, I think thats one of the things `mosh` solves.

While true, it just seems (to me) that if that's the only problem you're solving (which is to say, not needing to type the command "ssh host" and let your key log you in) and it's at the expense of not being able to properly ForwardAgent (which I require very heavily in my line of work), then it's a lot of work for negative return.

But, again, to each their own. As mentioned below, if your latency over a phone connection is so bad that this helps you, then by all means, use it. :) I'm just noting that for pretty much everyone I work with, this would be a step backwards.

Re:Mosh: A replacement for SSH by Piskvorrr on Monday September 01, 2014 @08:50AM (#8252569)
Try autossh - a useful hack on top of ssh, which helps with the auto-resume issue, somewhat.
Re:Mosh: A replacement for SSH by sagichmal on Monday September 01, 2014 @06:54AM (#8252302)

    > you could just add a "/bin/screen -DR; exit" to your 
    > remote .bashrc and the screen integration would be 
    > completely invisible after the initial instantiation.
The problem is making all of those initial instantiations every time my connection is interrupted.
Re:Mosh: A replacement for SSH by pseudonym on Monday September 01, 2014 @07:24AM (#8252369)
You only make the initial instantiation once.

- SSH to remote

- on remote, run "screen"

- get disconnected from remote

- SSH to remote, .bashrc runs "screen -DR" and you resume from where you left off

You only have to create the initial screen session once, and it persists until you explicitly shut it down or restart the remote machine.

Re:Mosh: A replacement for SSH by colomon on Monday September 01, 2014 @08:06AM (#8252448)
Huh. I certainly don't remember step 4 from my time of using screen. Is it a new feature or an option I didn't know about or something?

And what happens if I want to have two terminal tabs on my end logged into the same remote machine? (Which is basically 100% of the time for me.) It seems like that would be a case where mosh would be much smoother...

(Disclaimer: Once upon a time I used screen, but I stopped ages ago. mosh is intriguing, but as long as I'm working from home just plain vanilla ssh is all I really need...)

Re:Mosh: A replacement for SSH by dedward on Monday September 01, 2014 @10:31AM (#8253000)
The ability to detach and re-attach to screen has been there since day one... that's probably one of the largest reasons most people use it. Terminal software these days can handle multiple sessions just fine - the benefit is being able to detach and re-attach.

Multiple terminals in one session was more critical back when we were using dumb terminals and whatnot - where you couldn't multiplex locally.

Re:Mosh: A replacement for SSH by colomon on Monday September 01, 2014 @01:41PM (#8253939)
Just so it's clear, I meant specifically the '.bashrc runs "screen -DR"' part, ie automatically going back into the screen rather than needing to explicitly run screen -DR like I used to. (I don't seem to be able to edit my original comment at the moment.)
Re:Mosh: A replacement for SSH by slavik81 on Monday September 01, 2014 @03:25PM (#8254326)
That's not something screen-specific. You can put whatever you want into .bashrc and it will be automatically run each time you open a new shell. pseudonym just suggested you could use it to automatically run a screen command.
Re:Mosh: A replacement for SSH by bshimmin on Monday September 01, 2014 @08:29AM (#8252512)
The detach/reattach functionality has always been a part of screen. It's called "multiplexing" (whence tmux gets its name).
Re:Mosh: A replacement for SSH by xorcist on Monday September 01, 2014 @04:23PM (#8254537)
> what happens if I want to have two terminal tabs on my end logged into the same remote machine

Don't do that. Open a new window in your screen instead.

Then start giving windows descriptive names. Then start giving them automatic names. Marvel at most fast you've gotten using the window selector (with type-ahead-find).

Re:Mosh: A replacement for SSH by andreasvc on Monday September 01, 2014 @11:51AM (#8253409)
> And what happens if I want to have two terminal tabs on my end logged into the same remote machine? (Which is basically 100% of the time for me.) It seems like that would be a case where mosh would be much smoother...

You can use 'screen -x' to attach multiple times to the same session.

Re:Mosh: A replacement for SSH by sagichmal on Monday September 01, 2014 @09:37AM (#8252733)
With mosh, I don't have to SSH to remote after I'm disconnected. That's what I was referring to.
Re:Mosh: A replacement for SSH by e40 on Monday September 01, 2014 @10:35AM (#8253026)
"I wish I had started this process in a screen session" problem

Why is everyone here assuming all programs can be run in a screen session? I run emacs over X11 through a tunnel. This is far superior to emacs in a screen session.

Re:Mosh: A replacement for SSH by icebraining on Monday September 01, 2014 @11:03AM (#8253163)
Why is everyone here assuming all programs can be run in a screen session?

Because that's what mosh is designed for. Graphical programs are off-topic.

By the way, we have used xpra ("screen for X") with success in the past: https://www.xpra.org/

Re:Mosh: A replacement for SSH by e40 on Monday September 01, 2014 @11:22AM (#8253272)
OK, fair enough. I didn't know about xpra.

I've solved this by buying FastX from StarNet. I run a server on Linux and display my X programs on my desktop at work. When I get home, where I run the client on my home desktop, I can connect to the same server and disconnect my work clients and reconnect them to my home machine. It's the perfect solution for me.

Re:Mosh: A replacement for SSH by rmrz on Monday September 01, 2014 @06:03AM (#8252182)
Mosh is really great for avoiding disconnections and local echo. Lack of SSH agent forwarding was a problem for me as well, but I have found a workaround - I open a separate plain 'ssh -A' connection at the same time when I need my keys. On target machines I have SSH_AUTH_SOCK pointing to the stable well known location, which is a symlink to the unix socket recreated always by the last 'ssh -A' connection on the server. This allows me to use ssh from tmux session connected using mosh.
Re:Mosh: A replacement for SSH by bascule on Monday September 01, 2014 @07:20PM (#8255074)
Agent forwarding is an antipattern, and insecure usage of it is prevalent. Forwarding it allows anyone who has root access on the remote system to impersonate you, and it can therefore be used to escalate privileges after a single system compromise.

Alternatively, consider Kerberos and kinit.

Re:Mosh: A replacement for SSH by MetaCosm on Monday September 01, 2014 @08:01AM (#8252440)
Mosh always seems oddly slow. I have a good connection to most of my servers (under 10ms to many, under 100ms to all)... and it just feels laggy, in vim sessions, in tmux scrollback, everywhere. I find just a vanilla ssh (with tmux always) to be far superior in terms of latency.

I love the idea of mosh, but I find the implementation to be lacking... or I am doing it wrong. :)

Re:Mosh: A replacement for SSH by andreasvc on Monday September 01, 2014 @12:01PM (#8253473)
That's odd. Regular ssh uses TCP while mosh uses UDP; perhaps there's some issue making UDP slower in your case?
Re:Mosh: A replacement for SSH by metafunctor on Monday September 01, 2014 @06:55AM (#8252305)
FWIW, there's this: https://github.com/rinne/mosh/tree/ssh-agent-forwarding

I haven't used the agent forwarding patch myself, though. The patch is rather large, which may be the reason it was never merged.

The author (rinne) is the former CTO of ssh.com, by the way.

Re:Mosh: A replacement for SSH by kapilvt on Monday September 01, 2014 @08:09AM (#8252457)
Awesome, that would solve my main issue with mosh, here's the discussion on the pull request https://github.com/keithw/mosh/pull/423
Re:Mosh: A replacement for SSH by Maakuth on Monday September 01, 2014 @05:38AM (#8252143)
Yep, it's in my daily tools as well and very useful especially for 2G mobile connections, bad Wi-Fi and alike. It seems their development has pretty much stopped after initial spark of enthusiasm. Too bad, mosh-over-ssh and port forwarding would be pretty killer features for many scenarios.
Re:Mosh: A replacement for SSH by zeroonetwothree on Monday September 01, 2014 @06:41AM (#8252278)
Yeah mosh is amazing. Just using screen isn't nearly as good because you still have restart the ssh connection. I usually have 5+ open at once so restarting them all is annoying.
Re:Mosh: A replacement for SSH by ryan-c on Monday September 01, 2014 @12:20PM (#8253586)
Are you aware that a forwarded agent can be used by anyone with access to your account (e.g. root) to authenticate as you? They can even re-forward your agent to their own computer.
Re:Mosh: A replacement for SSH by tjosten on Monday September 01, 2014 @05:38AM (#8252141)
/sign