How do I setup Mosh server access?

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.

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