Mosh (mobile shell)
Mosh (Mobile Shell) is an alternative to SSH made for unreliable networks. From 4.0, ZestSSH has its own Mosh client on every platform: nothing needs to be installed on your computer, phone or tablet. The host needs mosh-server, and UDP ports 60000 to 61000 open to it.
Availability
Section titled “Availability”| Platform | Status |
|---|---|
| Android | Built in |
| iOS (iPhone and iPad) | Built in |
| Windows | Built in (no WSL needed) |
| macOS | Built in, or the mosh program installed on the Mac (a setting) |
| Linux | Built in, or the mosh program installed on the computer (a setting) |
Before 4.0, Mosh hosts opened only on a computer, through the mosh program installed on it (inside WSL on Windows).
What Mosh is
Section titled “What Mosh is”- UDP after the sign-in: ZestSSH signs in over SSH to start
mosh-serveron the host, then the session is Mosh over UDP, which copes with lost and reordered packets. - Roaming: the session survives a change of address (another Wi-Fi network, cellular, a VPN that reconnects) and your device sleeping. On an iPhone or iPad it survives iOS suspending ZestSSH: when you come back, it picks up where it was, with no new sign-in.
- Encrypted: every datagram is encrypted and authenticated with the session’s own key (AES-128 in OCB mode). The key comes from
mosh-serverover your SSH sign-in, so the UDP path is trusted with nothing; it is never written to a log, and the native copy of it is wiped (the text that carried it from the host’s output cannot be). A damaged, forged or replayed datagram changes nothing.
Server requirements
Section titled “Server requirements”The host needs mosh-server installed:
# Ubuntu/Debiansudo apt install mosh
# Fedora/RHELsudo dnf install mosh
# Arch Linuxsudo pacman -S mosh
# macOS (Homebrew)brew install moshAnd UDP ports 60000 to 61000 must be open to the host, on the host’s own firewall and on any on the way (a cloud provider’s security group, for example):
# ufwsudo ufw allow 60000:61000/udp
# firewalldsudo firewall-cmd --permanent --add-port=60000-61000/udp && sudo firewall-cmd --reloadThe host needs a UTF-8 locale (en_US.UTF-8 or C.UTF-8); most systems have one.
Quick start
Section titled “Quick start”- On the Hosts page (or a phone’s Hosts tab), choose New host.
- Under Protocol, choose Mosh. The port is set to the default SSH port: ZestSSH signs in over SSH on that port first. A note says what the host needs: “Mosh needs mosh-server on the host and UDP ports 60000 to 61000 open to it. ZestSSH has its own Mosh client.”
- Type the Address and pick a Key or a password.
- Choose Save host, then connect to the host.
How it works
Section titled “How it works”- Sign-in: ZestSSH signs in to the host over SSH exactly as for an SSH session (its key or password, its network rules, its jump hosts and Compatibility mode), with no terminal.
- mosh-server: it runs
mosh-server new -s -c 256 -p 60000:61000 -l LANG=en_US.UTF-8on the host. Where the host has noen_US.UTF-8, it triesLANG=C.UTF-8. Where the host’s shell does not findmosh-serverby name, it tries/usr/local/bin,/opt/homebrew/bin,/opt/local/bin,/usr/binand/snap/bin. Through a jump host,-sis left out. - The key:
mosh-serverprints the UDP port it listens on and the session’s key. ZestSSH reads them and closes the SSH connection. The key is never logged, and is taken out of anything ZestSSH shows. - Mosh: ZestSSH’s own client talks Mosh to the host over UDP, to the address the SSH connection reached (through a jump host, to what the host’s name resolves to on your device; the connection log says which). It takes datagrams from that address only, and every datagram is sealed with the session’s key, which travelled inside SSH: the UDP path is trusted with nothing. The host’s screen shows in ZestSSH’s terminal; what you type and the terminal’s size go to the host.
- Roaming: if the host has not been heard from for 10 seconds, the terminal shows Last contact 12s ago in its top right corner (a screen reader is told once), and ZestSSH keeps trying, from a new local port too. The mark goes when the host answers.
- End: typing
exitends the session as an SSH session ends. Closing the tab tellsmosh-server, which ends the shell on the host.
The setting on a Mac and Linux
Section titled “The setting on a Mac and Linux”Settings > Terminal and SSH > Built-in Mosh client is on at first. Turn it off to open Mosh hosts with the mosh program installed on the computer, as before 4.0 (ZestSSH looks for it on your PATH and in /opt/homebrew/bin, /usr/local/bin and /opt/local/bin). It is the computer’s own setting: it is not synced. Windows, Android and iOS always use the built-in client.
Host settings
Section titled “Host settings”| Setting | Default | What it does |
|---|---|---|
| Address | (required) | Server host name or IP address |
| Port | Default SSH port | The SSH port ZestSSH signs in on to start mosh-server |
| Key or password | (optional) | How the SSH sign-in is made |
The UDP port range (60000 to 61000) is the same for every Mosh session and cannot be changed.
Limitations
Section titled “Limitations”- No local echo yet: what you type shows when the host echoes it, as over SSH. Mosh’s own client guesses ahead and underlines what it guessed; ZestSSH’s does not yet.
- The server needs
mosh-serverand open UDP ports 60000 to 61000. - Through a jump host: the sign-in goes through it, but the UDP goes straight to the host, which must be reachable from your device.
- No scrollback from the host: Mosh sends the screen, not every line that passed. Run
tmuxorscreenon the host to keep a history. - No agent forwarding or port forwarding in a Mosh session: they are for SSH sessions.
Troubleshooting
Section titled “Troubleshooting”Each of these messages ends in its code, and Copy details copies what happened (the key taken out).
| Code | What you see | What to do |
|---|---|---|
| ZS-1004 | “mosh-server is not installed on the host” | Install Mosh on the host (sudo apt install mosh), or set the host to SSH. |
| ZS-1005 | mosh-server found no UTF-8 locale |
On the host, sudo locale-gen en_US.UTF-8 (Debian, Ubuntu) or install glibc-langpack-en (Fedora, RHEL), then connect again. |
| ZS-1006 | mosh-server did not start, with what it said |
Read what it said under the message; run mosh-server new in an SSH session on the host to see the same. |
| ZS-1007 | mosh-server started, and nothing answered over UDP on its port |
Open UDP 60000 to 61000 to the host (its firewall and any on the way). mosh-server ends by itself after a minute without contact. |
| ZS-1008 | The Mosh session could not go on | Connect again. If it happens again, update mosh on the host, and send the details to support. |
| ZS-1001 | Mosh is not installed on this computer (a Mac or Linux with the built-in client turned off) | Turn Built-in Mosh client back on, or install mosh on the computer. |
| ZS-1003 | Eternal Terminal hosts open on a computer only | Shown for Eternal Terminal on a phone. Before 4.0 Mosh hosts showed it too. |
The screen looks stale
Section titled “The screen looks stale”- If Last contact shows over the terminal, the host is not answering: the network may have dropped, or blocks UDP. ZestSSH keeps trying.
- Press Ctrl+L to redraw it.
Q: Do I need to install anything on my phone or computer?
A: No. ZestSSH has its own Mosh client on every platform. Only the host needs mosh-server.
Q: Can I use Mosh through a jump host? A: The sign-in goes through the jump host, but Mosh’s UDP goes straight to the host. If the host cannot be reached from your device directly, use SSH.
Q: Is Mosh traffic encrypted?
A: Yes. Every datagram is encrypted and authenticated with AES-128 in OCB mode, with a key mosh-server makes for the session and hands over your SSH sign-in.
Q: Mosh or Eternal Terminal?
A: Mosh uses UDP and works on every platform in ZestSSH. Eternal Terminal uses TCP, so it gets through firewalls that block UDP, but it opens on a computer only, with its et program installed.