Mosh is a nifty, UDP-based client-server utility that greatly improves SSH connection’s reliability and usability, especially on flaky connections or if you need to jump on/off VPN, change IPs etc.

You need to install Mosh both on the client machine (Mac OS-X Lion in my case) as well as server (Debian Squeeze for the sake of this blog post).

Installing on Mac was almost as easy as promised by the documentation:

> brew update
> brew link pkg-config
> brew install mobile-shell

pretty much does it, given that you have latest XCode and HomeBrew installed.

Installing on Debian Squeeze was a whole different experience. The Mosh documentation only provides instructions for Ubuntu Lucid. You can try adopting it for Debian, but I did not really have much success, so I ended up installing from source, like this:

> sudo apt-get update
> sudo apt-get install protobuf-compiler libprotobuf-dev
> sudo apt-get install libboost-dev
> sudo apt-get install libutempter-dev libncurses5-dev
> sudo apt-get install zlib1g-dev
> sudo apt-get install expect-dev libexpect-perl
> cd
> wget
> tar xzvf mosh-1.1.3.tar.gz
> cd mosh-1.1.3
> ./configure
> make
> sudo make install
> mosh-server

Please make sure that UDP communication is not blocked by a firewall and connect to the server using a command like: