HideIPVPN
RSS Feed Click to Subscribe!

Using mobile shell Mosh for SSH sessions

The mobile shell Mosh is a command line remote terminal utility that works wrapped around SSH, it can be used inside xterm or Emacs, you will still need SSH running in the server, the main difference in between Mosh and SSH is that Mosh connects via UDP (User Datagram Protocol) instead of TCP (Transmission Control Protocol), UDP is ideal for unreliable Internet connections, like for example a mobile 4G network, you will not be disconnected from the server if your network temporarily drops, UDP does not verify that data reaches destination, Mosh will keep you connected even if your device IP changes or the computer goes to sleep. Mosh only runs UTF-8 character encoding but it fixes all Unicode bugs found in SSH.

The terminal will not fill with network buffers like sometimes happens in SSH, Mosh sets frame rates based on network conditions and if you encounter a run away process it can be terminated pressing CTRL-C

Laptop computer running Linux
Laptop computer running Linux

To use Mosh you have to install it in your computer or mobile device and the server you are connecting to, the server must have SSH running before Mosh connects via UDP in between ports 60000 and 61000 by default, use -p to specify a specific port, and then you type in the client mosh user@remotehost

The main reason why you would want to use Mosh as a substitute of SSH is to keep alive a SSH session resting on an inconstant connection, you can also use Mosh on the background in screen or tmux and SSH in the foreground, if SSH drops for any reason you could fetch Mosh as a back up, Mosh doesn’t need root rights and it will allow any user to execute it in user space even if they don’t own the server, it could be used on a restricted shell account.

A few drawbacks are that there is no IPv6 support and port forwarding is not possible yet, the developers have added it to the roadmap. There has been no cryptographic review of Mosh, this is not an SSH tunnelling utility, it deploys its own encryption scheme with AES-128bit (Advanced Encryption Standard) keys in OCB (Offset Codebook Mode) mode for authentication.

There are Mosh packages for NetBSD, FreeBSD, Mac OS X, Ubuntu, Debian, Fedora, Gentoo, ArchLinux, Android and Cygwin, the Unix environment for Windows.

Visit Mosh homepage

Add a Comment

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