mosh vs ssh for Unstable Connections
mosh handles network changes.
mosh
mosh and ssh are both remote shell tools. ssh is the universal default; mosh is the laptop-friendly alternative. Each fits different scenarios; understanding the differences guides the right choice.
What mosh provides:
- Survives network changes.: mosh is designed for unreliable connections. WiFi disconnections, network changes, sleep/wake cycles all are handled; the session persists; the user reconnects without redoing work.
- Roams between WiFi and 4G.: Engineers working from laptops often switch networks. Coffee shop WiFi to cellular to home WiFi; mosh handles each transition; ssh would drop the connection.
- Good for laptops.: The laptop's network behavior matches mosh's strengths. Engineers using laptops as their primary machine benefit; the connection survives the natural use patterns.
- Local echo.: mosh provides local echo of typed characters. The remote response can be delayed; the user's typing is visible immediately. The interactive feel is preserved.
- Reduces apparent latency.: Even on high-latency connections, mosh's local echo reduces perceived latency. Typing feels responsive; the remote response arrives when network allows.
mosh is the laptop-and-mobile tool. The roaming and latency-tolerance match the use case.
ssh
ssh is the universal remote shell. Everywhere; supports many ancillary tools; the default for remote operations.
- Universal.: ssh is everywhere. Every Linux server has it; every Mac has it; Windows now ships with it. The team can rely on it.
- SSH agents.: Key management via ssh-agent. Keys loaded once; used across sessions; the convenience is significant.
- SCP.: File transfer via scp. The protocol is well-understood; integration with other tools is wide; file copy across hosts is routine.
- sftp.: Interactive file transfer. The protocol layers above ssh; the same authentication, the same security; broader file management.
- Default.: The default tool for remote shell. Engineers know it; documentation assumes it; the team's runbooks reference it.
ssh is the universal default. The ecosystem and ubiquity are the value.
When
The choice depends on context. mosh for unstable connections; ssh for stable. Both have their place; the team uses each where it fits.
- mosh for working from coffee shops.: Unstable WiFi, network roaming, intermittent connectivity all favor mosh. The session survives; the engineer's productivity is preserved.
- ssh for stable.: Office connections, server-to-server connections, scripting all use ssh. The stable connection does not need mosh's roaming features.
- Both have a place.: The team uses each where it fits. mosh for laptop work; ssh for everything else.
- mosh requires both ends.: Both client and server need mosh. Some servers do not have it; ssh is the fallback.
- Skill transfer.: The same SSH keys work for both. The team's authentication setup is shared; learning mosh adds capability without duplicating the auth setup.
mosh vs ssh is one of those small tooling preferences. Nova AI Ops integrates with infrastructure observability, complementing the local-tool perspective with cluster-wide visibility for systematic investigation.