linux

How to install Mosh Shell as an SSH option on Linux

 

Mosh, which means Mobile shell is a command-line application used to connect to a server from a client computer over the Internet. It can be used SSH and includes more features than Protected shell.

It is a similar application to SSH, but with additional features. The application was originally written by Keith Winstein For a Unix-like operating system and released under the GNU GPL v3.

Mosh Shell SSH client
Mosh Shell SSH client

Mosh facilities and services

  1. It is a remote decision application that supports roaming.
  2. Available for all major UNIX-type operating systems, including Linux, FreeBSD, Solaris, Mac OS X, and Android.
  3. Ad hoc connection supported.
  4. Provides smart local echo.
  5. Supported user keyboard line editing.
  6. Responsive design and sustainable nature via Wi-Fi, mobile and remote connections.
  7. Stay connected even if the IP changes. It uses UDP instead of TCP (used by SSH). TCP timeout when the connection is reset or a new IP is assigned, but UDP keeps the connection open.
  8. The connection remains intact when you resume the session after a long time.
  9. No network delay. Displays user-entered key and deletions immediately without network delay.
  10. Same old way to log in as in SSH.
  11. Mechanism for handling packet loss.

Installing Mosh Shell on Linux

On Debian, Ubuntu and Mint on similar systems, you can install Mosh package using the apt-get package manager, as shown.

# apt-get update 
# apt-get install mosh

On RHEL/CentOS/Fedora distribution, you must turn on the third-party archive named EPEL, so you can install this archive using the mosh-yum package manager as shown.

# yum update
# yum install mosh

On Fedora 22+ version, you need to use the dnf package manager to install mosh as shown.

# dnf install mosh

 

It can be installed on other Linux distributions as shown.

# pacman -S mosh         [On Arch/Manjaro Linux]
$ sudo zypper in mosh    [On OpenSuse]
# emerge net-misc/mosh   [On Gentoo]

How do I use Mosh Shell?

1. Trying to log in to a remote Linux server with a mosh shell.

$ mosh [email protected]
Mosh Shell connection
Mosh Shell connection

Entry: Did you see that I got an error connecting because the port was not open on the remote control CentOS 7 box. The quick but not recommended solution was:

# systemctl stop firewalld    [on Remote Server]

The primary way is to open the port and update the firewall rules. And then connect to the mosh on a predefined port. For more information about the firewall, see this message.

  1. Configuring the firewall in CentOS, RHEL, and Fedora

2. Assume that the default SSH port 22 was changed to port 70, in this case you can specify a custom port ‘-p‘switch mosh.

$ mosh -p 70 [email protected]

3. Check the version of the installed Mosh version.

$ mosh --version
Check the Mosh version
Check the Mosh version

4. You can close the mosh session type ‘exit‘prompt.

$ exit

5. Mosh supports many options you may see:

$ mosh --help
Mosh Shell options
Mosh Shell options

Cons of Mosh Shell

  1. Mosh requires additional conditions, such as allowing a direct connection over UDP, which SSH did not require.
  2. Dynamic port allocation in the area 60000-61000. The first open fort is reserved. It requires one port per connection.
  3. Default port reservation is a serious concern, especially in production.
  4. IPv6 connections are supported, but roaming with IPv6 is not supported.
  5. Scrolling is not supported.
  6. X11 forwarding is not supported.
  7. No support for ssh agent forwarding.

Conclusion

Mosh is a nice little utility that can be downloaded from the archive of most Linux distributions. While it has a few inconsistencies, specifically related to security and additional requirements, its features include staying connected while roaming. I recommend that every Linux user working on SSH should try this application and keep it in mind, Mosh is worth a try.

If you appreciate what we do here at TecMint, you need to consider:

TecMint is the fastest growing and most trusted community site for all kinds of Linux articles, guides, and books online. Millions of people visit TecMint! Search or browse thousands of published articles that are accessible to everyone.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button