fastpipe.io Blog


Bleiben Sie über unsere Entwicklung und nützliche Tutorials auf dem Laufenden.

Go back

How to use Mosh as improved ssh implementation

Mosh (Mobile Shell) is a remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

What does that mean in general?

Mosh is able to keep your ssh connection alive, even when your network connection dies. With a regular ssh server/client setup, a reconnection means you need to login again.

Mosh solves this problem by using UDP instead of TCP and wraps all the ssh traffic inside of udp packets. This is quite useful if you are working from a public network (e.g. cellular connection) and move around between different stations.

Installing on Debian / Ubuntu

Beside our tutorial, mosh is also available for most other distributions – including FreeBSD, OpenBSD and so on. See https://mosh.org/#getting for further details.

Mosh is available since Debian Squeeze (Backports) and Ubuntu 12.04 or Later. In order to run a mosh server beside openssh-server, you just need to install mosh over the package manager:

apt-get install mosh

If you´re using Debian or Ubuntu as client, you can just install the mosh client also by installing the mosh package. For macOS and Windows there are seperate builds available.

After installing mosh, you can connect to your mosh server:

mosh my.server.tld

The mosh client will open a udp connection to the mosh server and finally wrap the ssh session to the ssh server. This is completely secure as it still profits from the encryption ssh provides.