hello.

home works snippets

Mosh: mobile shell

Mosh is a great terminal application for lazy developers(all of us). It allows a SSH session to stay connected over unstable internet connection. This means once we are connected with Mosh, we don’t have to retype that long SSH command to reconnect every time. As long as we don’t exit, we restart our computer the next day and the SSH session will be resumed right back.

Use the following command to install Mosh:

sudo apt-get install mosh

After the installation, we need to open up custom ports on the server. Mosh uses ports 60000-61000, so let’s add that …..

AWS Lightsail home -> click the instance we are using -> click “Networking” tab -> under “Firewall” section, click “Edit rules” -> Application type is “Custom”, Protocol is “UDP”, and Port range is “60000-61000” -> click “Save”

From our local machine we use Mosh client to initiate SSH connection:

mosh --ssh="ssh -i ~/.ssh/LightsailDefaltPrivateKey-us-east-2.pem" ubuntu@52.14.42.95

Done!