mosh - UDP based SSH tool in Linux
When it comes to remote access on Linux, SSH has been the go-to protocol for a long time. However, SSH is not without its shortcomings, particularly when it comes to network connectivity issues. This is where Mosh comes in. Mosh is a remote terminal application that uses UDP instead of TCP to connect to the server. This allows for better connectivity, especially over unreliable or high-latency networks. In this blog post, we’ll take a closer look at Mosh and its benefits.
Benefits of using Mosh
Mosh uses UDP instead of TCP, which means it can work better over unreliable or high-latency networks. This is because UDP doesn’t require a connection to be established before data can be sent, unlike TCP. This makes Mosh more resilient to network interruptions such as packet loss or high latency.
Mosh maintains a persistent connection to the server, even if the client’s IP address changes. This means that if you’re on a mobile device and you switch from Wi-Fi to cellular data, or you move to a different location, your Mosh session will remain active.
Mosh has several features that make it more user-friendly than SSH. For example, Mosh supports predictive local echo, which means that when you type a command, you can see the output immediately, even before it’s received by the server. Mosh also supports line editing, which allows you to edit your commands before sending them to the server.
TCP over UDP
- Install mosh
yum install epel-release
yum install mosh
apt install mosh
- Connect using the client
mosh user@ip -p 60001
- View mosh connections (default UDP port 60001, firewall needs to be opened)
netstat -unlp | grep mosh
- Start the mosh-server
mosh-server new -c 256 -s -l LANG=en_US.UTF-8 -p 60000
mosh-server (mosh 1.3.0) [build mosh 1.3.0]
Copyright 2012 Keith Winstein <email@example.com>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
- Connect using the generated key with mosh-client
MOSH_KEY=9S9Bz/KDYVMNyiJg2267nw mosh-client ip 60000
Note: If a character set problem is prompted, add the following to ~/.bashrc:
Mosh is a fantastic tool for remote access on Linux. It offers better connectivity, persistent connections, and enhanced usability compared to SSH. If you frequently access remote servers and you’re tired of dealing with SSH’s limitations, give Mosh a try. You won’t be disappointed!
Small world. Big idea!
- Welcome to visit the knowledge base of SRE and DevOps!
- License under CC BY-NC 4.0
- Made with Material for MkDocs and improve writing by generative AI tools
- Copyright issue feedback me#imzye.com, replace # with @