Features / Mosh

Walk out of the Wi-Fi. The session stays.

With SSH, a phone that changes networks or goes to sleep drops the connection. With mosh it carries on where it was.

TCP  22             the SSH login that starts mosh
UDP  60000–61000    the session itself

No UDP reply from mosh-server.
[ Switch to SSH ]

Why it’s there

Roams

When iOS finds a better path, Moshpit sends a packet down it and the server follows your new address. Nothing reconnects.

Feels local on a slow link

Predictive echo shows what a keystroke will most likely do before the server answers, and takes it back if the guess was wrong.

Back from the background

A connection that lived through the app being in the background is picked up again without a reconnect.

How it works

  1. Mosh is on by default for new connections and can be turned off per host.
  2. Moshpit logs in over SSH, starts mosh-server, then talks to it over UDP. The client is Moshpit’s own, written in Rust for mosh’s protocol.
  3. If mosh-server isn’t installed you still get a terminal over SSH, plus the install command for that host. Nothing is installed without you.

Good to know

  • Some networks let UDP out but not back in. Moshpit notices within seconds and offers Switch to SSH; it never switches quietly.
  • Not through a jump host: mosh needs UDP straight to the host.

Mosh in the docs →

More features