blob: 8b6fa0d8aa19a87a8a8b5ba188a59088aac053f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
set -eu
target="$1"
localport="5901"
while lsof -i:$localport; do
localport=$((localport + 1))
done
ssh -L "$localport":localhost:5900 "$target" \
'x11vnc -bg -localhost -display :0'
vncviewer "localhost:$localport"
ssh "$target" 'x11vnc -remote stop -localhost -display :0'
ssh -O cancel -L "$localport":localhost:5900 "$target"
|