Introducing … mobile shell

Trying to access a server when not at home or in office is sometimes really terrific. Having an unstable connection requires reconnects very often. When trying do a setup or a process that should run atomically in best case it is quite impossible. But there is a solution: mosh

How does it work?

Having a connection to a server via ssh and let’s assume there are network problems. Then the connection is interruped. So when loosing the ssh connection and there was a process running but not finished, you do have a problem. You have to reconnect and you don’t know what happened to the process.

Mosh connects to the server via ssh. Then it creates a session on the server. A shell is executed in scope of that session. But when using mosh and having network problems, the following happens: Mosh provides this session to the new ssh connection that demands this mosh session. When there was a process running the results are captured by the mosh server. When a mosh client connects to the server, the old mosh session and thus the shell is assigned to the new ssh connection. So it is possible to work on the shell as if there hasn’t been a disconnect. Using an unstable network connection, mosh server keeps the session and provides it when there is a connection again. Even when there is a new ip address assigned to the client, it is possible to reconnect to the old session.

There is no need for a new secure shell. No extra service. No boilerplate. When trying to connect with a mosh client to a mosh server this is tunneled through a standard ssh connection. No additional security risk.

Installation

When using Android, simply install JuiceSSH. It provides connecting to a server via mosh.

The installation on many other operating systems is described on the mosh homepage.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.