We found that Mosh doesn’t handle host urls. We suggest using the Desktop Application for connections since app.remote.it will generate a new proxy url that you will need to resolve to an IP address each time. The desktop urls will always resolve to localhost (127.0.0.1)
Additionally, the server kills itself once the client exits, therefore you need to fetch new key every time you want to connect, which is a real pain. “man mosh-server”: mosh-server exits when the client terminates the connection.
Here are the steps for set up.
-
Locally on the device, open UDP endpoints configured on port 60001 (or whatever you have configured) and SSH endpoint on port 22
-
Install Remote.It on the device with the Mosh server.
-
Create 2 services in Remote.It for your device (one for SSH pointed to 22, one as UDP pointed to your configured port)
-
Start both connections, note the Remote.It port assigned for each (you will use these for the connections). We will not be using the remote.it URL but instead the IP it resolves to which is 127.0.0.1
-
Use SSH to launch the mosh server and fetch the key to my STDOUT
For example if the username is pi and the SSH connection port from the Desktop Application is 33007
ssh pi@127.0.0.1 -p 33007 "mosh-server new -s -p 60001" > /dev/stdout | grep -e "MOSH CONNECT" | awk '{print $2}'
- Connect with mosh, for example the port for the Remote.It Mosh UDP connection is 33006
MOSH_KEY=XXXX mosh-client 127.0.0.1 33006
You then can create a script for ease and to connect faster, where you specify both ssh and mosh ports for Linux. If you are using Windows, this would need to be translated for use, likely using Chrome. Unfortunately we will not be able to help with Windows.
Pass in $1 and $2 with the Remote.It connection ports where $1 is the SSH port and $2 as the MOSH UDP port.
MOSH_KEY=$(ssh -l pi 127.0.0.1 -p $1 "mosh-server new -s -p 60001" > /dev/stdout | grep -e "MOSH CONNECT" | awk '{print $2}')mosh-client 127.0.0.1 $2