Last active
February 15, 2024 01:36
-
-
Save henri/8a9ab4efd505557abb94b05a4808d6a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mosh (connection using specific public key-pair) | |
mosh --ssh="/usr/bin/ssh -i ~/.ssh/identity" [email protected] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# link to ghostbuster forked gist to kill mosh clients | |
https://gist.github.com/henri/7e0390ff154df4f8993ea2f1903ac2f1 | |
# man mosh-server options (enviroment variables) | |
# you can set this varible in seconds and this will kill stale mosh sessions (probably better than the options further down) | |
# additional information : https://community.clearlinux.org/t/configuring-environment-variables-for-mosh-server/6742 | |
MOSH_SERVER_NETWORK_TMOUT # 604800 (one week) or 2592000 (30 days) | |
# mosh cleaner (clean out those old sessions) | |
https://git.zx2c4.com/mosh-cleaner/about/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scroll back with mosh + install instructions | |
https://medium.com/@toja/tip-using-mosh-with-scrollback-257a54a848b3 | |
# carful dont overwrite an exiting tmux.conf - you can just edit the file and add the lines as required | |
cat <<_EOF_ > "/${HOME}/.tmux.conf" | |
new-session | |
set -g history-limit 30000 | |
set -g mouse on | |
_EOF_ | |
# connect to server and enable scroll back via tmux (a : attach / reconnect / new if not found) | |
mosh <server> -- tmux a | |
# connect to server enable scroll back via tmux (and specify session name) | |
mosh <server> -- tmux new -s mosh-session-$HOSTNAME | |
# if running fish and you dont have $HOSTNAME set, then this will work | |
mosh <server> -- tmux new -s mosh-session-(hostname) | |
# tmux additional options (connect and reconnect) if you can not be bothered doing that manual should mosh fallover. | |
# for me personally, I am not worried about reconnecting as much as I am keen on scroll back history. The ability | |
# to reconnect manually if needed is just an added bonus or a security issue depending on your use case / persective. | |
# But if you find this and are looking for running tmux with or statments or perhaps some other more complex syntax, | |
# then this link (below) will provide all the grusome details of starting a specific shell and running a command : | |
https://stackoverflow.com/questions/22976504/how-can-i-run-complicated-commands-on-establishing-a-mosh-connection | |
# you can also go away from mosh and use ET (great if you are not addicted to the predictive features of mosh) | |
https://eternalterminal.dev/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment