Using an SSH client tool is always helpful and handy for the system administrator and the remote users. In the conventional SSH clients, you may find some network and auto session logout issues. As a system admin, you already realize the importance of the CLI-based remote SSH client. To solve frequent logout, lagging, and packet loss issues, you can install the Mosh SSH as an SSH alternative on Linux. The Mosh stands for the Mobile shell, which is a command-line-based secure shell client for Linux. It doesn’t require a stale and static IP address to establish the connection; moreover, the Mosh SSH shell client is also compatible with mobile devices.
Mosh Shell as SSH Alternative on Linux
The Mosh SSH shell uses the TCP network connections and supports roaming. Whatever you type at the local terminal gets send to the TCP remote host, and whatever the application prints come back to your screen. All the user interface of the Mosh SSH shell, including the keystrokes, comes from the server.
In Linux, the Mosh shell allows you to switch from one network connection to another without losing the SSH connection. The Mosh SSH shell is written in C++ programming language, and it is built under the GNU GPL privacy license. In this post, we will see how to install Mosh shell as an SSH alternative on Linux.
1. Install Mosh Shell On Debian/Ubuntu
Installing the Mosh SSH client on a Debian or Ubuntu Linux is easy and straightforward. It is available in the official Linux repository. If your computer doesn’t have any UFW or firewall daemon system, you don’t need to worry about the firewall system. You can run the following commands on your terminal shell to update your Linux repository and install the Mosh SSH shell on your Linux system.
# apt-get update
# apt-get install mosh
2. Install Mosh SSH On Fedora/Red Hat Linux
If you run a Fedora or a Red Hat-based Linux system, you can install the Mosh SSH shell on your Linux through the YUM or DNF command. It is up in the Linux repository and doesn’t require any EPEL packages. First, run the following set of commands on your shell to install the Mosh SSH shell on your Linux machine.
Run the following commands to install Mosh shell on Fedora Linux.
# yum update
# dnf install mosh
The following commands will install Mosh shell on the Red Hat Linux enterprise.
# yum update
# yum install mosh
3. Install Mosh SSH On Arch, SuSE, and Other Linux
In Arch and Arch-based Linux distributions installing Mosh shell is a quick task. You just need to run the following Pacman command on your terminal shell with root privilege to install it.
# pacman -S mosh
If you are a SuSE Linux user, run the following zypper command to install Mosh SSH on your system.
sudo zypper in mosh
In this step, we have seen the methods of installing Mosh on Arch and SuSE Linux; if you still can’t find ways to install Mosh on your distribution, download the Mosh source code from here, and install it from Source Code.
When the download finishes, extract the compressed file and run the following commands on your terminal shell given below to install Mosh from the source code.
$ cd mosh-1.3.2
# make install
Get Started with Mosh Secure Shell
Till now, we have seen how to install the Mosh shell on various Linux systems. It’s now time to run the Mosh secure shell on the command line. All the following commands that we will use in this step will be executable on all major Linux distributions. First, you might need to run the following command to check the version of Mosh SSH shell.
$ mosh --version
To connect a remote client over the internet through the Mosh client, run the following command on your terminal shell. The following command consists of the syntax mosh, client username, and the client’s IP address.
$ mosh [email protected]
If you run the command successfully, you would need to confirm by typing ‘Yes’ in the shell, and later, it will require the client’s root password to establish the connection. If you can’t establish a connection through the Mosh, ensure that the SSH service is configured and enabled on the client’s end. When you need to end a session, you can run the following exit command to end your shell’s session.
To get more help about the Mosh syntaxes, running the help command is always beneficial.
$ mosh --help
I have briefly explained what Mosh shell is, how it works, and how you can install it on a Linux system in the entire post. If you still have confusion on if the Mosh shell is secure or not, or is it better than the traditional SSH clients, well, I can’t explain a lot here. All I can ensure is, it hoes have some cons and pros, but in the conventional use of an SSH session, you won’t notice the cons. I would recommend you to give it a try and find all the answers to all your thoughts.
Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.