0 vote
Mosh is a UDP based remote shell protocol that utilizes ssh infrastructure for authentication. It's extremely usefull in scenarios of high latencey and bad connectivity. Instead of dropping the connection with the remote server, it will simply reconnect your session when connectivity returns to normal. I'd like to have the option to open a mosh session from RDM using credentials stored within it.
Link to the mosh website: Mosh: the mobile shell
Hello,
Thank you for your request. Could you let us know on what platform you currently use Mosh? From what I can tell on its website, it doesn't have a native Windows integration which probably means we can't integrate it as easily in RDM on Windows.
Regards,
Hubert Mireault
Also I looked into it and if we can't invoke Mosh through command line on Windows, there isn't anything we can do to integrate it in RDM, as the code for Mosh is on the GPL license.
Regards,
Hubert Mireault
The way I do it is through WSL. For example I'll run:
wsl mosh <<username>>@<<host>>
That feature does have to be enabled, a distribution has to be installed and then mosh has to be installed in that WSL environment for that all to work though.
Perhaps you could use the Command Line entry in RDM as a proof of concept? That entry should allow you to specify any command to be run. I'm not very familiar with WSL but if the line you mentioned is simply called through CMD, then that entry should work. It will at least confirm how we should go about trying to integrate this in RDM.
Regards,
Hubert Mireault
OK, let me chime in and dig this one up before starting yet another thread...
Why?
Sadly SSH isn't quite as good in recovering from dropouts as one would hope, as such open connections frequently disconnect when on the go. While you can keep your jobs/sessions running using terminal multiplexers like tmux or screen, it is easy to loose track of where you where if you have to renonnect all connections first.
At least in the circles I know "mosh" is pretty common for laptop users administering Linux systems. It is an UDP based SSH alternative, which will keep sessions open, even if your device roams to a new IP or was suspended. Basically your connection will stay open, as long as your device isn't rebooted or the connection is closed by yourself.
Setup
As bbrougher suggested, WSL is probably the way to go. While the current version doesn't support IPv6 (Thanks, Microsoft...), it is very easy to set up. In my case I had already set up Debian and used apt to install mosh. If you are on a fresh system these commands (Powershell as admin) should help you get started. Keep in mind this is a basically full, secondary operating system, so expect it to consume ~3GB of disk space and download a few hundred MBs using your internet connection:
# Install WSL2 itself wsl --install # You may see some UAC-prompts during install. You should be able to find wsl in start menu afterwards. You may need to reboot. Install debian next wsl --install -d debian # Also debian should appear in start menu. A reboot might be required as well. # During installation an assistant may ask you to create a user account. # As it is the only distribution installed we can run linux commands using "wsl <command>". # Download list of available software next wsl sudo apt update # Next update all installed components. The WSL image may be outdated and contain outdated software. wsl sudo apt full-upgrade # ...and install mosh itself wsl sudo apt install mosh
Optional: Enable IPv6 / WSL1
As stated earlier Microsoft decided to disable IPv6 for WSL2. As IPv4 addresses are getting more and more costly this might be a problem, as long as you want "proper" IP connectivity and not deal with dozens of address translations breaking stuff. Also a lot of cloud stuff is v6 only. Luckily you can "Downgrade" to WSL1, which had IPv6 support, using a few commands.
wsl --set-version Debian 1
Usage
Well, you can use mosh as usual. Just add wsl before the command...
wsl mosh user@myserver.example.com
Integration (>=2023/Windows Terminal)
Now for the fun part. How to get mosh inside RDM while there is no official support. Search for "Windows Terminal" located in category "Other/Miscellaneous" when creating a new entry. Enter a name and ensure "Display" is set to "Embedded (tabbed)". As command use the one we already found: wsl mosh user@myserver.example.com. Keep in mind this relies on Windows Terminal. While preinstalled on Windows 11 you may need to manually install it using Microsoft Store on Windows 10 (https://aka.ms/terminal).
Integration (<=2022)
Search for "Command Line (External Application)" located in category "Other/Miscellaneous" when creating a new entry. Enter a name and ensure "Display" is set to "Embedded (tabbed)". As command use the one we already found: wsl mosh user@myserver.example.com.
On Windows 10 this will probably work as expected. Sadly RDM has a hard time embedding windows terminal sessions as used on Windows 11 - the terminal opens in a new window and RDM remains unresponsive until the mosh session is closed. In this case you have to update to RDM >=2023 and use the method described above or trick it a bit:
"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10262.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe" (check path, it might change when updating!)C:\Windows\system32\wsl.exe -d Debian mosh user@myserver.example.com
Tabs/Window decoration is somewhat broken, but the terminal itself should be usable. It is possible to open multiple sessions, each gets a own terminal window (and as such a tab in RDM).
Gotchas
While this mostly works, running in WSL is another layer which might break stuff. Most isn't really a concern when just running a text terminal like mosh, but you may loose some handshake stuff like the possibility to log on using smartcards/WebAuthN. There are some workarounds which might help you tho.
Hello,
Thank you for the very well described explanation on how to configure mosh to work within RDM. I'm sure this will help our users.
Just an addition, you mention the following:
On Windows 10 this will probably work as expected. Sadly RDM has a hard
time embedding windows terminal sessions as used on Windows 11 - the
terminal opens in a new window and RDM remains unresponsive until the
mosh session is closed.
In RDM 2023.1, we added a new entry for Windows Terminal, which should embed correctly. For Windows 11 you could try and use this entry instead of the Command Line, maybe it will be smoother.
Regards,
Hubert Mireault
In RDM 2023.1, we added a new entry for Windows Terminal, which should embed correctly. For Windows 11 you could try and use this entry instead of the Command Line, maybe it will be smoother.
Thanks, hadn't updated yet. I've edited the post to reflect both ways.