mobile-shell / mosh

Mobile Shell
https://mosh.org
GNU General Public License v3.0
12.7k stars 743 forks source link

Wrote a launcher for mosh-client and mosh-server for Windows #1304

Closed robertsdotpm closed 10 months ago

robertsdotpm commented 11 months ago

Hello, I love the idea behind mosh and it works perfectly for every platform I tested it on. I even managed to get it working on my android VM. BUT... it doesn't seem to play well with Windows. I spent hours trying to get mosh to work on Windows and eventually learned that the only way it works is that you have to:

  1. Manually start mosh-server and grab the details.
  2. Manually start mosh-client with the details above.

Obviously this isn't hard to do but its tedious and defeats the point of the command. So I decided to write a simple fix for this. The idea is that the systems that have mosh servers on them will run custom REST servers. Requesting a URL on the server will start a new mosh server and then return the connection details already formatted as a mosh-client command. That can then be easily built into a command that will login via ssh, curl the URL, and execute the command, to spawn a mosh shell.

Example usage for a client looks like this: bash -c "$(ssh matth@win10 curl http://localhost:8088/ 2>/dev/null)" Whereas that server will have ran: python3 main.py in the background.

I decided to build a server like this because I was finding that trying to run mosh-server directly after SSH login just meant that the SSH server would kill the mosh-server process the moment the connection dropped. I tried every possible approach I could think of to have the process keep running but Windows openssh service would kill the process every time. So at least with an independent server like this it spawns mosh-server as a sub process and keeps the resource handles around so it doesn't just die. The shell then stays open no matter what the SSH server does.

Anyway: repo = https://github.com/robertsdotpm/mosh-launchd code = https://github.com/robertsdotpm/mosh-launchd/blob/main/main.py

faymek commented 3 weeks ago

hello, there is a windows scoop app that works

scoop install mosh-client

https://bjansen.github.io/scoop-apps/main/mosh-client/