Mosh (software)
   HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, Mosh (mobile shell) is a tool used to connect from a client computer to a server over the Internet, to run a remote
terminal Terminal may refer to: Computing Hardware * Terminal (electronics), a device for joining electrical circuits together * Terminal (telecommunication), a device communicating over a line * Computer terminal, a set of primary input and output dev ...
."Mosh: the mobile shell"
Retrieved on 28 March 2013.
Mosh is similarBrockmeier, Joe
"Into the Mosh Pit: A Mobile Shell Replacement for SSH"
, ''linux.com'', 10 April 2012. Retrieved on 28 March 2013.
to
SSH The Secure Shell Protocol (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution. SSH applications are based on ...
, with additional features meant to improve usability for
mobile Mobile may refer to: Places * Mobile, Alabama, a U.S. port city * Mobile County, Alabama * Mobile, Arizona, a small town near Phoenix, U.S. * Mobile, Newfoundland and Labrador Arts, entertainment, and media Music Groups and labels * Mobile ( ...
users. The major features are: * Mosh maintains its session even when it " roams" (when the client endpoint changes to different IP addresses), for example by moving to a different
Wi-Fi Wi-Fi () is a family of wireless network protocols, based on the IEEE 802.11 family of standards, which are commonly used for local area networking of devices and Internet access, allowing nearby digital devices to exchange data by radio wave ...
network or when changing from Wi-Fi to 3G. * Mosh maintains the terminal session (not "connection" in the TCP-sense because Mosh uses UDP) even when a user loses their Internet connection or puts their client to "
sleep Sleep is a sedentary state of mind and body. It is characterized by altered consciousness, relatively inhibited sensory activity, reduced muscle activity and reduced interactions with surroundings. It is distinguished from wakefulness by a de ...
". In comparison, SSH can lose its connection in such cases because TCP times out.Cox, John
"MIT researchers chart a new approach for mobile Internet protocols"
, ''Network World'', 6 July 2012. Retrieved on 28 March 2013.
* Mosh client attempts to be responsive to keyboard events (typing, erasing characters with the key, and so on) without waiting for network
lag Lag, or similar, may refer to: Lag * Łąg, Poland * Lag (company), a French guitar maker * Lag (cue sports), a brief pre-game competition to determine which player will go first * Latency (engineering), a slower response time in computing, commu ...
. It uses an adaptive system that predicts whether the application running on the server will decide to
echo In audio signal processing and acoustics, an echo is a reflection of sound that arrives at the listener with a delay after the direct sound. The delay is directly proportional to the distance of the reflecting surface from the source and the list ...
the user's keystrokes or deletions.Beckert, Axel
"Mosh and AutoSSH: Remote shell tools that make your life easier on a slow or constantly morphing network"
''Linux Magazine'', November 2012.
Leyden, John
"MIT's mind-reading Mosh pits itself against SSH daemons"
''The Register'', 13 April 2012. Retrieved on 28 March 2013.
The main drawbacks of mosh are additional prerequisites to the server, that it lacks some special features of SSH (such as connection forwarding) and the lack of a
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and entert ...
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
client. An alternative for Linux servers (that still require installation on the server) is to use
GNU Screen GNU Screen is a terminal multiplexer, a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate login sessions inside a single terminal window, or detach and reattach sessions from ...
on top of a regular SSH connection.


Design

Mosh works at a different
layer Layer or layered may refer to: Arts, entertainment, and media * ''Layers'' (Kungs album) * ''Layers'' (Les McCann album) * ''Layers'' (Royce da 5'9" album) *"Layers", the title track of Royce da 5'9"'s sixth studio album * Layer, a female Maveri ...
from SSH. Whereas SSH transmits a stream of bytes in each direction (from server to client or client to server) using TCP, Mosh runs a
terminal emulator A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term ''terminal'' covers all remote termin ...
at the server to figure out what should be on the screen. The server then transmits this screen to the client at a varying frame rate, depending on the speed of the network.Winstein, Keith
"Mosh: An Interactive Remote Shell for Mobile Clients"
USENIX Annual Technical Conference 2012, Boston, Mass., 14 June 2012.
This allows Mosh to save on network traffic on slow or intermittent connections.


Supported platforms

Mosh is available for most
Linux distribution A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
s,
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
,
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
,
NetBSD NetBSD is a free and open-source Unix operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is a ...
, and
OpenBSD OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD 1.0. According to the website, the OpenBSD project em ...
, Android,
Solaris Solaris may refer to: Arts and entertainment Literature, television and film * ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem ** ''Solaris'' (1968 film), directed by Boris Nirenburg ** ''Solaris'' (1972 film), directed by ...
,
Cygwin Cygwin ( ) is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed. The Cygwin in ...
, and as a
Chrome App A Google Chrome App, or commonly just Chrome App, was a certain type of (non-standardized) web application that ran on the Google Chrome web browser. Chrome apps can be obtained from the Chrome Web Store where apps, extensions, and themes can be ...
. The iOS program Termius includes an independent implementation of the Mosh protocol.


Performance


Roaming

Mosh is built on the State-Synchronization Protocol (SSP), which supports single-packet roaming.Winstein, Keith and Balakrishnan, Hari
"Mosh: An Interactive Remote Shell for Mobile Clients (more detailed draft)"
Retrieved on 28 March 2013.
After the client has switched to a new IP address, a single packet that successfully reaches the server is enough to "roam" the connection. The client does not need to know it has roamed. (The client may be using
NAT Nat or NAT may refer to: Computing * Network address translation (NAT), in computer networking Organizations * National Actors Theatre, New York City, U.S. * National AIDS trust, a British charity * National Archives of Thailand * National As ...
and the NAT roamed instead.)


Packet loss

In the Mosh research paper, the creators tested SSP on a link with 29% packet loss, and found that SSP reduced the average response time by a factor of 50 (from 16.8 seconds to 0.33 seconds) compared with SSH, which uses TCP. A different study, by students at
Stanford University Stanford University, officially Leland Stanford Junior University, is a private research university in Stanford, California. The campus occupies , among the largest in the United States, and enrolls over 17,000 students. Stanford is consider ...
, found that SSP reduced the average response time by a factor of 30 (from 5.9 seconds to 0.19 seconds).Nagaraj, Kanthi and McMilin, Emily
"Mosh"
''Reproducing Network Research'', 14 March 2013. Retrieved on 28 March 2013.


Local echo

According to Mosh's developers, the program was found to be able to predict and immediately display 70% of user keystrokes, reducing the median response time to a keystroke to less than 5 milliseconds (masking the latency of the network). A different study, by students at Stanford University, found that Mosh was able to quickly echo 55% of user keystrokes.Aljunied, Ahmed
"Evaluation of Mosh 'Mobile Shell' Performance Results"
''Reproducing Network Research'', 13 March 2013. Retrieved on 28 March 2013.


Drawbacks

Compared to the more popular
SSH The Secure Shell Protocol (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution. SSH applications are based on ...
, mosh has the following drawbacks:


Prerequisites on the server

The major drawback of mosh is that it requires the server to fulfill additional prerequisites which are not needed by ssh itself. Due to its design, mosh needs the server to allow direct connections via UDP. Servers not fulfilling these prerequisites cannot be used by mosh. Examples of such systems include servers behind firewalls which restrict connections to the ssh-port via TCP. Also problematic are servers which are only indirectly reachable. The latter is usually accommodated by ssh via the 'ProxyCommand' option, but this is not supported by mosh.


One port per connection

By default, the server tries to allocate the first free UDP port in the range 60001–61000, per connection. This dynamic port allocation is considered an extra burden and risk for firewall maintenance. A significant part of the firewall-filtering happens through connection tracking, so called stateful filtering, this is based on the SYN/ACK flags in TCP segments, UDP packets don't have such flags. Mitigation: # The UDP port on the server can be set per mosh connection, so that only a limited number of ports need to be opened # Deep packet inspection firewalls and
application firewall An application firewall is a form of firewall that controls input/output or system calls of an application or service. It operates by monitoring and blocking communications based on a configured policy, generally with predefined rule sets to c ...
s can handle this better by looking at content of the packet and associate it to the initial connection


Output drops and lack of terminal scrollback

Scrollback is not supported in the current release of mosh, and when using it in a terminal emulator with scrollbars they disappear, but is planned for the 1.3 release. This functionality is trade-off for garbage cleaning, as binary output is wiped away. One way to mitigate this currently is by using mosh in combination with a terminal multiplexer like
screen Screen or Screens may refer to: Arts * Screen printing (also called ''silkscreening''), a method of printing * Big screen, a nickname associated with the motion picture industry * Split screen (filmmaking), a film composition paradigm in which mul ...
or
tmux tmux is an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window. It is useful for running more than one command-line program at the same time. ...
.


Lack of ssh-agent forwarding

ssh-agent forwarding is not currently supported.


Lack of X11 forwarding

X11 The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wi ...
Forwarding is not yet supported."Support X forwarding"
/ref>


See also

*
Block-oriented terminal A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. The teletype was an example of an early-day hard-copy terminal and ...
*
Command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...


References

{{Unix commands Application layer protocols Unix software