Linux Tactic

Say Goodbye to SSH Woes: Why Mosh is the Future of Remote Shell Access

Introduction to SSH and its Shortcomings

Telnet, a protocol used for remote command-line access, was the go-to method for server administrators in the past. However, Telnet has its fair share of vulnerabilities.

Telnet sends all data, including user credentials, in plain text, which means that anyone snooping on the network can easily intercept and read the traffic. This makes it easy for attackers to steal sensitive data and gain unauthorized access to systems.

The rise of the Secure Shell (SSH) protocol as a replacement for Telnet has been a boon for network security. Unlike Telnet, SSH uses encryption to protect sensitive data from eavesdropping and tampering.

However, SSH has its own shortcomings.

Advantages of SSH

Encryption: SSH encrypts all traffic between the client and server. This means that even if an attacker manages to intercept the traffic, they won’t be able to read or modify the data.

Eavesdropping protection: SSH protects against eavesdropping attacks by encrypting all data before sending it over the network. Tampering protection: SSH uses message integrity checks to ensure that data is not tampered with in transit.

Shortcomings of SSH

Buffering: SSH buffers data until it receives enough to fill a packet. This can lead to delays, especially on slow networks.

Processing: SSH processes data in real-time, which can lead to decreased performance on high-latency connections. Disconnected sessions: If the network connection is lost, the SSH session is terminated, causing any unsaved work to be lost.

Mosh: A Solution to SSH Connectivity Issuesto Mosh

Mosh (short for Mobile Shell) is a replacement for SSH that addresses some of the shortcomings of SSH. Mosh is designed to work around the limitations of mobile networks and high-latency connections.

How Mosh Works

Mosh uses the UDP protocol, a connection-less protocol that allows data to be sent without waiting for an acknowledgment. This means that Mosh can send data without waiting for an answer, reducing latency and allowing Mosh to work better on high-latency connections.

Mosh also uses the State-Synchronization Protocol (SSP) to synchronize the state between the client and server. SSP is designed to handle network disruptions gracefully, allowing Mosh to recover from disconnections without terminating the session.

Comparison with SSH

Security advantages: Mosh does not have the same level of encryption as SSH. However, Mosh still provides basic encryption protection, and the improved usability makes it easier to secure the overall system.

Usability: Mosh has a number of usability enhancements that make it easier to use. For example, Mosh supports line editing, tab completion, and syntax highlighting, making it easier to work with command-line tools.

Latency connections: Mosh is specifically designed to work well on high-latency connections. By using the UDP protocol and SSP, Mosh can reduce the effects of latency and make remote connections more responsive.

Installing Mosh

Mosh is available on most Linux distributions and can typically be installed via the package manager. For those using Ubuntu, the installation of Mosh can be done by running the following commands:

sudo apt-get update

sudo apt-get install mosh

Configuring Mosh on Remote Server

Mosh requires UDP ports 60000-61000 to be open on the server. To ensure that Mosh can connect, you may need to add a firewall rule to allow traffic on these ports.

For example, if you are using the Ubuntu Firewall (ufw), you can use the following command to allow traffic on the required ports:

sudo ufw allow 60000:61000/udp

Connecting through Mosh

Connecting through Mosh is similar to connecting through SSH. To connect to a remote server via Mosh, you need to use the mosh command instead of the ssh command.

For example, to connect to a remote server with an IP address of, you would run the following command:

mosh [email protected]

You can also specify an SSH port if needed:

mosh -p 22 [email protected]

Mosh will automatically establish a connection and synchronize the state between the client and server. If the network connection is lost, Mosh will try to reconnect automatically.


Mosh is a powerful tool for remote shell access that addresses the shortcomings of SSH. By using the UDP protocol and SSP, Mosh can provide a better user experience on high-latency connections while still providing basic encryption protection.

Installing and configuring Mosh is straightforward, and connecting through Mosh is similar to connecting through SSH. Give Mosh a try next time you need to connect to a remote server.

In summary, SSH has largely replaced Telnet as the go-to method for remote command-line access due to its encryption and eavesdropping protection. However, SSH has its own shortcomings, such as buffering, processing, and disconnected sessions.

Mosh is a powerful replacement for SSH that addresses these issues by using the UDP protocol and SSP. With Mosh, users can expect improved usability and latency connections, while still receiving basic encryption protection.

By installing and configuring Mosh, users can avoid the limitations of SSH and ensure a smoother remote shell access experience.

Popular Posts