Mosh – SSH Replacement

I had not been aware of Mosh (mobile shell), though clearly its own level of awesome is not a reason for that. Basically it replaces SSH, but still uses it for authentication and the like.

Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes. > Mosh is a replacement for SSH. It's more robust and responsive, especially over Wi-Fi, cellular, and long-distance links. > Mosh is free software, available for GNU/Linux, BSD, macOS, Solaris, Android, and Chrome. An iOS version is in testing.

https://www.youtube.com/watch?v=XsIxNYl0oyU

Install and Configure Mosh

// install mosh, enhancement/replacement to ssh
// first create services file for firewalld, then reload and make permanent

sudo yum install mosh

sudo nano /etc/firewalld/services/mosh.xml



  MOSH
  Mosh (mosh.mit.edu) is a free replacement for SSH that allows roaming and supports intermittent connectivity.











sudo firewall-cmd --reload
sudo firewall-cmd --add-service=mosh --permanent
sudo systemctl restart firewalld

// use command:
//      mosh --ssh="ssh -v -i /full/path/to/privkey" user@server
// replace for
//      ssh -v -i /full/path/to/privkey user@server

Error Messages

If you get You have a detached Mosh session on this server, try:

kill $(ps --no-headers --sort=start_time -C mosh-server -o pid | head -n -1)

That will kill all but the latest session (hopefully yours, which you can then exit out of and re-enter.

See Also