Skip to content
Snippets Groups Projects
Commit 4d103fb5 authored by nimrod's avatar nimrod
Browse files

Add SSH local forwarding script.

parent ed97aa2b
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
set -eu
usage () {
echo "Usage: $0 host forward"
}
host="$1" || { usage >> /dev/stderr; exit 1; }
forward="$2" || { usage >> /dev/stderr; exit 1; }
alias ssh='ssh -fnNTS ~/.ssh/%C.sock'
if ! ssh -O check -L "$forward" "$host"
then
ssh -o ControlMaster=auto -o ControlPersist=0 -o ExitOnForwardFailure=no -o ControlPersist=0 "$host"
ssh -O forward -L "$forward" "$host"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment