mosh - Mobile Shell
What is Mosh?
Mosh (Mobile Shell) is a remote terminal application similar to SSH but designed to work better in mobile and unstable network environments. It supports roaming, intermittent connectivity, and intelligent local echo and line editing.
Why is Mosh useful?
Maintains session even if the IP address changes (e.g., switching networks).
Automatically reconnects after temporary network loss.
Reduces perceived latency through local echo.
More responsive than SSH on high-latency connections.
Ideal for users working remotely or on mobile networks.
How it works?
Mosh starts by using SSH to authenticate and establish an initial session.
It then starts a mosh-server on the remote machine and connects using a custom UDP-based protocol.
The client and server communicate over UDP, enabling session continuity even with network changes.
Mosh predicts user input locally and updates when the server responds, providing fast feedback.
Where is Mosh used?
Remote system administration over unstable or mobile networks.
Developers and sysadmins working over Wi-Fi, cellular, or satellite links.
Any situation where SSH performance is affected by latency or roaming.
Which OSI layer does this protocol belong to?
Mosh operates primarily at the Application Layer (Layer 7).
It uses UDP at the Transport Layer but implements its own reliability and state tracking.
IS Mosh Windows specific?
No, Mosh is not Windows-specific.
While originally built for Unix-like systems, Mosh clients can be used on Windows via WSL, Cygwin, or compatible ports.
IS Mosh Linux Specific?
No, Mosh is not Linux-specific, though it’s primarily used on Linux, macOS, and BSD.
The server side is usually installed on Unix-like systems, but clients can run on multiple platforms.
Which Transport Protocol is used by Mosh?
Mosh uses UDP for all communication after the initial SSH connection.
It implements its own protocol on top of UDP for reliability and encryption.
Which Port is used by Mosh?
Mosh uses UDP ports in the range 60000–61000 by default.
The actual port is chosen randomly and communicated during the SSH handshake.
Is Mosh using Client server model?
Yes, Mosh uses the client-server model.
The client initiates a session via SSH, then switches to a UDP-based connection with the mosh-server running on the remote system.
In this section, you are going to learn
Terminology
Version Info
rfc details
setup
setup
packet details
usecases
features
Reference links