Difference between revisions of "Mosh"
m |
(Prepared the page for translation) |
||
Line 1: | Line 1: | ||
<languages/> | |||
<translate> | |||
Two of the discomforts of using a CLI to SSH into a node are: | Two of the discomforts of using a CLI to SSH into a node are: | ||
Line 12: | Line 14: | ||
<asciinema loop=1 poster="npt:0:15" autoplay=1 src=https://plebnet.wiki/images/1/1f/MoshCast.cast /> | <asciinema loop=1 poster="npt:0:15" autoplay=1 src=https://plebnet.wiki/images/1/1f/MoshCast.cast /> | ||
== Client-side and server-side installation == | == Client-side and server-side installation == | ||
Line 22: | Line 25: | ||
brew install mosh | brew install mosh | ||
== Usage == | == Usage == | ||
Line 44: | Line 48: | ||
$ alias m="mosh --ssh='ssh -i ~/.ssh/my_key.pem' ubuntu@X.X.X.X" | $ alias m="mosh --ssh='ssh -i ~/.ssh/my_key.pem' ubuntu@X.X.X.X" | ||
== use over slow connections == | == use over slow connections == | ||
Line 52: | Line 57: | ||
Experimental prediction provides a totally seamless typing experience on your node, as if you were typing on your localhost's CLI. | Experimental prediction provides a totally seamless typing experience on your node, as if you were typing on your localhost's CLI. | ||
Line 57: | Line 63: | ||
Mosh uses UDP port 60001, so make sure you open this port in your firewall settings. If you close a terminal without terminating the session, the user can remain logged in, which then occupies the port. For this reason, you may also want to consider opening port 60002. Another option is to ssh in, to kill the zombie session. | Mosh uses UDP port 60001, so make sure you open this port in your firewall settings. If you close a terminal without terminating the session, the user can remain logged in, which then occupies the port. For this reason, you may also want to consider opening port 60002. Another option is to ssh in, to kill the zombie session. | ||
== Killing Zombie Sessions == | == Killing Zombie Sessions == | ||
Line 68: | Line 75: | ||
$ pkill -9 22056 | $ pkill -9 22056 | ||
</translate> |
Revision as of 19:38, 2 October 2021
Two of the discomforts of using a CLI to SSH into a node are:
- disconnections
- latency while typing
Mosh solves these issues and provides a far superior user experience. The key differences are:
- Mosh uses a persistent UDP connection, sessions remain active even between disconnections or laptop lid closes.
- Mosh uses predictive typing ("local echo") so typing feels instant, even on remote lightning nodes.
Client-side and server-side installation
On linux:
sudo apt-get install mosh
On OSX:
brew install mosh
Usage
Instead of typing:
$ ssh ubuntu@X.X.X.X
You can use mosh:
$ mosh ubuntu@X.X.X.X
If using a pem file for authentication, instead of:
$ ssh -i ~/.ssh/my_key.pem ubuntu@X.X.X.X
Use:
$ mosh --ssh='ssh -i ~/.ssh/my_key.pem' ubuntu@X.X.X.X
That's a rather long command, so you may want to consider setting up an alias, e.g
$ alias m="mosh --ssh='ssh -i ~/.ssh/my_key.pem' ubuntu@X.X.X.X"
use over slow connections
If you're moshing over a slow connection, or into a very distant lightning node:
$ mosh --ssh='ssh -i ~/.ssh/my_key.pem' --predict=experimental ubuntu@X.X.X.X
Experimental prediction provides a totally seamless typing experience on your node, as if you were typing on your localhost's CLI.
Firewall Settings
Mosh uses UDP port 60001, so make sure you open this port in your firewall settings. If you close a terminal without terminating the session, the user can remain logged in, which then occupies the port. For this reason, you may also want to consider opening port 60002. Another option is to ssh in, to kill the zombie session.
Killing Zombie Sessions
If you have a zombie session preventing you from moshing in, simply kill it with:
$ who -u $ ubuntu pts/1 2021-07-21 12:40 . 22056 (X.X.X.X via mosh [22056])
Then:
$ pkill -9 22056