Strovent SystemsSign in
Reference

What Mosh needs on the host

The installation, UDP ports, locale and firewall settings Mosh needs, and what common errors mean.

Mosh needs more than SSH on the host.

On the host

  • mosh-server installed and in the PATH of a normal SSH login. Packages are called mosh on most Linux and BSD systems. Ask the administrator on shared systems.
  • A UTF-8 locale. mosh-server stops if the locale is not UTF-8. Check with locale. Set LANG=en_US.UTF-8 or similar in the shell profile.
  • An account that can log in with SSH.

On the network

  • UDP must pass between your device and the host. The default range is 60000 to 61000. Each session uses one port.
  • On a cloud host, open that UDP range in the firewall and in the cloud security group.
  • If a firewall allows only some ports, pick one that is open with mosh -p.
  • NAT is fine for the client. The server must be reachable.
  • A jump host does not carry UDP. Mosh cannot connect through one. See Jump hosts. For what you can do instead, see Can Mosh go through a jump host or bastion?.

Typical errors

  • "mosh-server: command not found". It is not installed, or not on the path of a non-interactive login. Use the full path or fix the host's PATH.
  • "mosh-server needs a UTF-8 native locale to run." Set a UTF-8 locale on the host.
  • The client waits and then gives up with no screen. The UDP packets are not getting through: check the firewall and security group, and that nothing on the device or network blocks UDP.
  • The login works but the session starts and drops. A middlebox may be dropping UDP. Try SSH.

Checking quickly

On the host:

which mosh-server
locale | grep -i utf

From outside, test that the UDP range is open on the cloud console, not with a TCP port test.

Spotted a mistake? Email [email protected].