Kehinde Adeleke
Jan 6, 2026

Mosh: a Better SSH

I set up a droplet on Digitalocean today, and then SSH'd into it with Ghostty. It worked okay but I also noticed that the latency was downright awful.

Every keystroke took a couple milliseconds to register. The server location was London which is relatively closer to Lagos than say San Francisco, but that didn't help much.

Running ping <ip-address> returned the following:

round-trip min/avg/max/stddev = 138.865/151.274/162.856/6.837 ms

The average round trip was around 151ms which wasn't ideal.

I investigated with the help of Claude, and it revealed a number of ways to solve it. One interesting solution was a program called Mosh.

Mosh is a mobile shell and calls itself a replacement for interactive SSH terminals. It supports roaming, reliability on spotty connections and implements a local echo.

With local echo, Mosh doesn't wait for the server reply before it shows the current keystroke. It was exactly what I needed.

Setting up Mosh

I installed using homebrew.

brew install mosh

Usage was straightforward.

mosh <ip-address>

I immediately got an error. It complained about not being able to find the mosh server.

On my server I also had to install it. The server is Ubuntu 24.04.3 LTS and I installed with apt.

apt install mosh

You can find installation instructions for other distros on the website

Once installed, I connected again using:

mosh <ip-address>

It worked as intended.

The latency reduced drastically and it made typing less painful.

Interestingly, I didn't have to pass in my private key even though I have both id_rsa and id_ed25519 present. With SSH, I have to run:

ssh -i ~/.ssh/id_ed25519 root@<ip-address>

I guess Mosh probably scans the .ssh directory and tries every private key until one works.