How to Connect Remote Unix/Linux Systems using Mosh Shell - SSH based client

To Connect Remote Unix/Linux Systems using Mosh Shell &ndash SSH based client

The abbreviation of Mosh shell is Mobile Shell. It is a command-line application used for connecting to the server from a client computer. It is used as SSH and it contains many advantages than the Secure Shell. This tutorial explains the mosh shell installation process.

Advantages of Mosh

  • The remote terminal application is supports for roaming.
  • Linux,Solaris,FreeBSD,Mac OS X and Android,UNIX-like OS viz are available.
  • To support Intermittent Connectivity.
  • To provides the intelligent local echo.
  • To support Line editing of user keystrokes.
  • To Responsive the cellular and long-distance links, design and Robust Nature over Wifi.
  • Packet loss is handled by Mechanism.

To install Mosh Shell in Linux

On Debian, Ubuntu and Mint

apt-getupdate
apt-get install mosh

On Fedora 22+ version

dnf install mosh

On RHEL/CentOS7

[root@linuxhelp ~]# yum install mosh
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centosmirror.go4hosting.in
 * epel: ftp.cuhk.edu.hk
 * extras: centosmirror.go4hosting.in
 * updates: centosmirror.go4hosting.in
Resolving Dependencies
-->  Running transaction check
--->  Package mosh.x86_64 0:1.2.5-1.el7 will be installed
..........
..........
Transaction test succeeded
Running transaction
Installing : mosh-1.2.5-1.el7.x86_64                               1/1 
Verifying  : mosh-1.2.5-1.el7.x86_64                               1/1 

Installed:
  mosh.x86_64 0:1.2.5-1.el7                                              

Complete!

Now the installation Mosh Shell is completed.

To check on your IP

[root@linuxhelp ~]# ifconfig eno16777736
eno16777736: flags=4163< UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.138  netmask 255.255.255.0  broadcast 192.168.7.255
 inet6 fe80::20c:29ff:fe2d:8cf8prefixlen 64  scopeid 0x20
ether 00:0c:29:2d:8c:f8  txqueuelen 1000  (Ethernet)
        RX packets 4232  bytes 866166 (845.8 KiB)

To use Mosh Shell

Login into the remote Linux server using Mosh Shell.

[root@linuxhelp ~]# mosh user1@192.168.7.141
The authenticity of host ' 192.168.7.141 ()'  can' t be established.
ECDSA key fingerprint is b0:55:a7:62:43:77:fc:2d:67:0e:c5:99:f2:73:aa:44.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ' 192.168.7.141'  (ECDSA) to the list of known hosts.
user1@192.168.7.141' s password: 

To check remote server IP

[user1@linuxhelp ~]$ ifconfig eno16777736
eno16777736: flags=4163< UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.141  netmask 255.255.255.0  broadcast 192.168.7.255
        inet6 fe80::20c:29ff:fe99:65e8prefixlen 64  scopeid 0x20
ether 00:0c:29:99:65:e8  txqueuelen 1000  (Ethernet)
        RX packets 193311  bytes 177026405 (168.8 MiB)

To check the mosh version

[user1@linuxhelp ~]$ mosh &ndash version
mosh 1.2.5 [build mosh 1.2.5]
Copyright 2012 Keith Winstein< mosh-devel@mit.edu> 
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.

Assume the port alternatively UDP 60007 for mosh shell.

To change the UDP port alternatively

[root@linuxhelp ~]# mosh-server new -l LANG=en_US.UTF-8 -p 60007
MOSH CONNECT 60007 ylDxOphAL96DxneiWy5SQQ
mosh-server (mosh 1.2.5) [build mosh 1.2.5]
Copyright 2012 Keith Winstein< mosh-devel@mit.edu> 
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.

[mosh-server detached, pid = 12041]

To login using alternative port via mosh shell

[root@linuxhelp ~]# mosh -p60007 user1@192.168.7.141
user1@192.168.7.141' s password: 

The close mosh session type is ‘ exit’ .

[user1@linuxhelp ~]$ exit
[root@linuxhelp ~]# mosh -p 60007 user1@192.168.7.141
user1@192.168.7.141' s password: 

[mosh is exiting.]

A lot of options are supports in Mosh.

[root@linuxhelp ~]# mosh
Usage: /usr/bin/mosh [options] [--] [user@]host [command...]
        --client=PATH        mosh client on local machine
                                (default: " mosh-client" )
        --server=COMMAND     mosh server on remote machine
                                (default: " mosh-server" )

The port didn’ t open in the remote CentOS 7 box as firewall was enabled.

systemctl stop firewalld [on Remote Server]

Or you can also open the per-defined port in firewall.

You should install mosh server in remote server.

Mosh Shell Cons

  • Allow direct connection via UDP is the additional prerequisite examples of Mosh.
  • The range of Dynamic port allocation is 60000-61000. To allocate the first open port. The one port per connection is required.
  • Especially in production port allocation is default a serious security.
  • To support IPv6 connection, but it not supported for roaming on IPv6.
  • The Scroll back is not supported.
  • To support No X11 forwarding.
  • The ssh-agent forwarding is not supported.
Tag : SSH
FAQ
Q
How to use Mosh to connect?
A
To run mosh, the easiest way to do that is by typing
$ mosh remote_destination
Mosh will try to connect to remote_destination using current user. If we want to define the user, then we can type :
$ mosh username@destination_server
Q
Is there any lag in the network during mosh shell?
A
No network lag. Shows users typed key and deletions immediately without network lag.
Q
What is the command to check the version of the mosh shell?
A
The command used to verify the version of the mosh
Syntax: " mosh --version"
Q
Is roaming on IPv6 not supported in the mosh shell?
A
No, here IPv6 connections supported but roaming on IPv6 not supported.
Q
What is the help command for mosh shell in Linux?
A
The command used for help menu for mosh shell in Linux is

Syntax: " mosh --help"