===== Network =====
=== rsync using SSH ===
rsync -P -rsh HOST:/source/path/ /destination/path/
''HOST'' being defined in ''~/.ssh/config''
=== Using mosh with a rebound server ===
When using a poor connection, [[man>mosh]] is a great tool ([[https://github.com/mobile-shell/mosh|github]])
My goal is to quickly open a connection to my rebound server having synced my ssh config.
#!/bin/bash
#
# usefull to connect to an host using a mosh jump server when using poor internet on the client side.
#
# The Jump server on witch mosh is installed as defined in ~/.ssh/config
JUMP_SERVER="MY_JUMP_SERVER"
# de UDP port to use on the server, leave empty for default.
MOSH_PORT="12345"
echo "Updating SSH bookmarks from ~/.ssh/config"
grep -Eo "Host [A-Za-z0-9_-]+" ~/.ssh/config | cut -c 6- | sed -e 's/^/ssh /' > ~/.bookmarks-ssh
echo "uploading ~/.ssh/config to jump server"
scp ~/.ssh/config $JUMP_SERVER:~/.ssh/config
if [ ! "$MOSH_PORT" ];then
echo "No port defined"
mosh $JUMP_SERVER
else
echo "Port $MOSH_PORT defined"
mosh -p $MOSH_PORT $JUMP_SERVER
fi
To make the typing faster on the rebound server, I use the same method as [[en:tools:linux:misc-tools#bookmarks|this script]] to get to automatically type my destination using ''.bookmarks-ssh''.