Mobile Shell is a free and fast remote terminal application. It allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes. You have already learned about SSH. Mosh aims to support the typical interactive uses of SSH. Since Mosh is more robust and responsive, especially over Wi-Fi, cellular, and long-distance links, it is known as a good replacement for interactive SSH terminals. Mosh is also available almost for all GNU/Linux, FreeBSD, Solaris, Mac OS X, and Android. This article presents Configure Mosh Shell as SSH Alternative on Ubuntu 20.04. Do not miss various available packages that help you to order your own Ubuntu VPS. You can find what you need on Eldernode.
Table of Contents
Tutorial Configure Mosh Shell as SSH Alternative on Ubuntu 20.04
Mosh is a UDP-based transfer system that is designed for mobile devices or laptops on slow connections. It is known as an alternative to SSH. Even if you change WiFi networks or experience fluctuating cell signals, Mosh will keep your connections alive. In the following, you will be more familiar with Mosh and learn how to configure it on Ubuntu 20.04 LTS.
What is Mosh and How it works?
Mosh is free and command-line software that used to connect from a client computer to a server over the Internet to run a remote terminal. It is available for GNU/Linux, BSD, macOS, Solaris, Android, Chrome, and iOS. Mosh is similar to SSH, with additional features meant to improve usability for mobile users. Mosh is more intelligent than SSH. While the SSH client waits for a TCP response from the server before showing your typing, Mosh will display your typing in real-time and even gives underlined typing predictions. The mosh program will SSH to user@host to establish the connection. As you know, SSH may prompt the user for a password or use public-key authentication to log in. But mosh runs the mosh-server process (as the user) on the server machine. In this way, Mosh brings a few noticeable advantages over well known SSH connections.
On long delay or unreliable links, Mosh is faster and more responsive. So, it is not difficult to say that Mosh is an alternative for SSH. Mosh attempts to reconnect to your pi automatically when the connection is lost even without you noticing.
Let’s review the most important reasons for using Mosh instead of SSH in the below:
1- Mosh will stay connected even if your IP changes.
2- Mosh will resume the connection with your network machine when your network comes back after losing the internet connection or when you put your system in sleep mode.
3- You don’t need to be a superuser to install or run Mosh.
4- Mosh client logs in to the server via SSH, and users present the same credentials as before.
5- Mosh will run inside your Terminals such as xterm, gnome-terminal, urxvt, Terminal.app, iTerm, emacs, screen, or tmux.
6- Unlike SSH Mosh doesn’t fill up network buffers, so Control-C always works to halt a runaway process. Suppose if you requested a 200MB file instead of 100MB, you can stop it immediately by pressing CTRL+C.
Mosh Shell Advantages
You know more about Mosh Shell now, if you are not sure to replace it with SSH, have a look at the below list:
1- Mosh is highly efficient.
2- Mosh works well on low bandwidth or intermittent connections.
3- Same as ET, the connection persists across WiFi networks, and interruptions.
4- Mosh lets you type at times when SSH and ET would still be waiting for a command to finish or connection to be re-established.
5- Mechanism to handle packet loss.
6- Mosh is able to work with the same old method to login as it was in SSH.
Prerequisites to Install Mosh Shell on Ubuntu 20.04 | Ubuntu 18.04
To let this tutorial work better, please consider the below Prerequisites:
_ A non-root user with Sudo privileges.
_ To set up, follow our Initial server setup on Ubuntu 20.04.
How to Install Mosh Shell on Ubuntu 20.04
To install Mosh package on your Ubuntu 20.04 system, you just need to run the following commands:
apt-get update -y
apt-get install mosh -y
Note: If you are running a firewall like iptables, use the command below to open these ports manually:
sudo iptables -I INPUT 1 -p udp --dport 60000:61000 -j ACCEPT
Configure Mosh Shell as SSH Alternative on Ubuntu Linux
Once Mosh shell is installed, you can start using it. So, run the command below to connect to your remote system:
mosh root@Your_IP_Address
And an output as below should be shown:
Then, you should be able to connect to your remote system. Also, you can check the version of the installed Mosh by running the command below:
mosh --version
Mosh supports a lot of options, To view all of them, type:
mosh --help
Conclusion
In this article, you learned how to Configure Mosh Shell as SSH Alternative on Ubuntu 20.04. Mosh is a remote terminal application that supports roaming. It is available for download in the repository of most of the Linux Distributions. As a Linux-er you are recommending to try using this application. If you have any experience, send your feedback to your friends on Eldernode Community.