Skip to content

ssh port forwarding doesn't work #337

Open

Description

@staticfloat

I believe this is because of the fact that mosh-server takes over from sshd and sshd quits, therefore the tunnel disappears just after it is made. It would be nice if mosh could keep sshd alive if -L or -R are present in the --ssh argument

Activity

  1. sessyargc commented on Oct 22, 2012

    @sessyargc

    I think this would be good if you connect and disconnect per session. If you use mosh to connect only once, one foreseeable problem is when the remote device changes IP address while roamin. mosh is able to auto-negotiate the new IP address ... one of mosh's goals (How Mosh works) ... but the tunnel would be good as dead in this case.

  2. keithw commented on Oct 22, 2012

    @keithw
    Member

    I don't want to add a feature to mosh that unexpectedly stops working once the client roams for the first time. If we add port forwarding, it will need to roam (like the rest of mosh). We wouldn't just leave the SSH connection up to break later.

  3. staticfloat commented on Oct 22, 2012

    @staticfloat
    Author

    Good points, and mosh obviously can't auto-reconnect the SSH tunnel because
    of authentication issues, right?
    On Oct 21, 2012 11:16 PM, "Rommel Custodio" [email protected]
    wrote:

    I think this would be good if you connect and disconnect per session. If
    you use mosh to connect only once, one foreseeable problem is when the
    remote device changes IP address while roamin. mosh is able to
    auto-negotiate the new IP address ... one of mosh's goals (How Mosh works)
    ... but the tunnel would be good as dead in this case.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/337#issuecomment-9653535.

  4. omry commented on Apr 3, 2015

    @omry

    why wouldn't mosh be able to reconnect the tunnel as well?

  5. brainstorm commented on Sep 17, 2015

    @brainstorm

    Yeah, I would like to drop those lines in my ~/.ssh/config:

    Host somehost
        HostName example.com
        LocalForward 5558 example.com:5558
        User admin
    

    And be able to have that local tunneling done with mosh too. Is it that different from a plain SSH connection that drops and recovers?

  6. brainstorm commented on Oct 7, 2015

    @brainstorm
  7. dwwoelfel commented on Jun 30, 2016

    @dwwoelfel

    The bounty for this feature is up to $200, now.

  8. mharradon commented on Nov 11, 2016

    @mharradon

    I threw in a bit, up to $235.

    Could anybody familiar with the Mosh codebase comment on the expected difficulty of this addition? Perhaps point out the relevant files? That might make it easier for somebody to take a crack at it.

  9. wittrup commented on Dec 18, 2016

    @wittrup

    I currently use some ugly "auto"ssh script that run ssh like this:

    reverse=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 ))
    /usr/bin/ssh -o ExitOnForwardFailure=yes$identity_file -N -R $reverse:localhost:22 -p $port $host; } 2>&1

    Having mosh do that for my network of raspberry pi would be awesome. Bounty increased.

  10. claui commented on Jul 26, 2017

    @claui

    The bounty has now reached $300.

  11. MisterTea commented on Sep 20, 2017

    @MisterTea
  12. brainstorm commented on Sep 21, 2017

    @brainstorm

    @MisterTea sure, but my HPC cluster has only mosh server(s) installed so far... I reckon that with ET they would have to install yet another service? If ET works well against Mosh server, that would solve the issue for me, if not, this bounty is still relevant to me ;)

  13. MisterTea commented on Sep 21, 2017

    @MisterTea

    @brainstorm Yep, ET is it's own server that you have to install. Where I work we have 100s of engineers using ET, but it's up to your use case to decide whether it works well for you.

  14. bkarlson commented on Oct 3, 2017

    @bkarlson

    Does not look like ET supports remote (-R) tunneling either
    MisterTea/EternalTerminal#59

  15. d4l3k commented on Jul 10, 2018

    @d4l3k

    I just took a look at some of the Mosh source code to see how hard this would be to implement reconnecting streams. From my naive perspective, it seems like the Mosh protocol doesn't map very cleanly to adding extra network streams since the protocol is designed to only have one stream each way.

    To add TCP like support you'd have to create a new state syncronizer that acts like a TCP connection (probably based off of Network::UserStream() since that's a reliable connection).

    But you're still stuck with the issue that mosh only allows one stream each way. Looks like there's three main ways to do this:

    • Create multiple Network::Transport connections, one for each TCP/UDP stream. This would require some major refactors to how mosh connections get established since they assume one ip/port per session.
    • Modify Network::Transport to support multiple senders and receivers. This seems like a huge pain since it's using C++ templates and having an arbitrary number of streams seems painful.
    • Create a multiplexer stream that can multiplex multiple streams over the existing connection. This seems like the easiest since it doesn't involve modifying much of the existing code base.

    All of these options would likely break backwards compatibility.

  16. 19 remaining items

  17. achernya commented on Apr 28, 2023

    @achernya
    Collaborator

    I'm sorry, what is the bounty comment supposed to mean?

  18. aatkinson commented on Apr 28, 2023

    @aatkinson
  19. Sepero commented on Aug 24, 2023

    @Sepero

    I don't want to use Bounty Source, but I want to contribute another $300 raising the bounty

    Total to $955

    I can make payment through PayPal or Monero or other. If you are a mosh developer and accept then please let me know, as I will send you half ($150) immediately to begin development, and the other half after changes are merged into master or a testing branch

    My offer to accept this job expires Jan 1 2024

    My Session Messenger ID:

    05a3e56b415d89a6e67c210de3164cde95b843ba65ad2d2529be96dcea97474912
    
  20. tsunamaru commented on Aug 25, 2023

    @tsunamaru

    +$50 on Bounty Source from me. Counting above contribution from @Sepero, the total is now at $1005.

  21. huyz commented on Aug 25, 2023

    @huyz

    What's the downside of BountySource? the 10% fee? Or these problems: bountysource/core#1586

  22. Sepero commented on Aug 25, 2023

    @Sepero

    I've used Bounty Source before and had problems with them, so I'd rather not have that again. Thank you @tsunamaru for helping push the bounty over $1000

  23. tsunamaru commented on Aug 25, 2023

    @tsunamaru

    Welp, I just read about Bountysource problems (thanks @huyz for pointing that out) and decided to ask PayPal for refund. I'm not sure if or when it'll be processed but regardless I will be happy pay my part to anybody after their changes is merged, would it be PayPal, crypto or any other suitable method.

  24. keithw commented on Aug 25, 2023

    @keithw
    Member

    Folks, I don't want anybody to waste their money here -- I don't think the issue is about money; it's about changes people are asking for in the Mosh/SSP protocol. These protocol changes would have to be designed, and then implemented at both ends of the connection, and then supported. Think about other protocols or interchange formats you might want to change -- can you post a $1,000 bounty and get them to add a new field to TCP or a new tag to HTML? :-)

    Adding support for reliable byte streams would be a big change to the Mosh protocol, and I don't sense anybody is eager to design, implement, and support this kind of major change. I think EternalTerminal can probably already do this; you might consider using that if you need reliable byte streams.

  25. makeasnek commented on Aug 25, 2023

    @makeasnek

    Please do not use bountysource. Many devs have had trouble getting paid there. You can check out this lemmy community as an alternative https://lemmy.ml/c/bugbounties

    For statements from devs who have been unable to cash out from bountysource see:
    https://github.com/bountysource/core/issues

  26. lonnywong commented on Jul 1, 2024

    @lonnywong
  27. huyz commented on Jul 1, 2024

    @huyz
  28. added a commit that references this issue on Oct 22, 2025
    6e6a26c
  29. Sepero commented on Oct 23, 2025

    @Sepero

    I maked another mosh with ssh port forwarding: https://github.com/trzsz/tsshd

    Hey, that's fantastic. I should have a look at it. Thank you for your contribution.

  30. lonnywong commented on Oct 23, 2025

    @lonnywong

    Shameless plug: Sorry for bothering you all before, and thanks @huyz @Sepero for your trust.
    One more thing, @Drag0nFly is testing the latest tssh and tsshd and discussing it in the issue trzsz/trzsz-ssh#167 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions