# Mosh (Mobile Shell) — Survive Flaky Connections

Tempest's **Mosh** support gives you SSH that survives sleep, network changes, and lossy Wi-Fi. Bootstrap over your normal SSH connection, then Tempest switches the session to UDP and keeps the terminal alive even when your laptop goes through three different networks on the train ride home.

If you've ever lost a `vim` buffer to a 30-second VPN drop, this is the doc you wanted.

## How Mosh works

Standard SSH runs over TCP — when the underlying connection breaks, the session dies. Mosh:

1. Uses your existing SSH credentials to bootstrap (so you don't need a new auth method).
2. Spawns `mosh-server` on the remote.
3. Switches the terminal to a UDP-based protocol with a moving session key.
4. Reconnects automatically when your IP changes or when the network drops out and comes back.

The visible result: type a command, close your laptop lid, walk home, open it on a different Wi-Fi — your prompt is still there, your `vim` is still open, your `tail -f` resumes from where it left off.

## Enable Mosh on a connection

1. Edit your SSH host.
2. Toggle **Mosh** on in the Transport section.
3. Optional: customize the `mosh-server` command (default: `mosh-server new -s -c 256 -l LANG=en_US.UTF-8`).
4. Save and reconnect.

## Server-side requirements

* `mosh` (or at least `mosh-server`) installed on the remote: `apt install mosh`, `brew install mosh`, etc.
* UDP ports 60000–61000 open on the firewall (Mosh picks one in this range).

## What doesn't work with Mosh

Mosh closes the SSH channel after bootstrap, so anything that needs the underlying SSH connection is unavailable while Mosh is active:

* SFTP file transfer (use a separate non-Mosh tab)
* Port forwarding
* Tempest Monitoring (no SSH channel to run sample commands)
* Connection multiplexing
* Tempest agent injection
* X11 forwarding

These constraints come from how Mosh works, not from Tempest specifically.

## Windows note

Mosh is **not supported on Windows** in Tempest. If you enable Mosh on a Windows install, Tempest will fall back to plain SSH and warn you. The Mosh protocol depends on `mosh-server` and the upstream Mosh project doesn't ship a Windows client.

## See also

* [SSH Port Forwarding](/connect-to-servers/ssh-port-forwarding.md) — runs over SSH, not Mosh
* [SFTP File Manager](/files-and-storage/sftp-file-manager.md) — also SSH-only


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gotempest.app/connect-to-servers/mosh-mobile-shell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
