summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon GECOS <u@adam>2023-05-31 20:54:19 -0400
committerGordon GECOS <u@adam>2023-05-31 20:54:19 -0400
commitc0a0041f01536a968584234a65e2140ad4f76343 (patch)
tree5f5fef3325390d5027f79fed33caade6a02d56c8
old changes
-rwxr-xr-xxvnc32
1 files changed, 32 insertions, 0 deletions
diff --git a/xvnc b/xvnc
new file mode 100755
index 0000000..649580a
--- /dev/null
+++ b/xvnc
@@ -0,0 +1,32 @@
1#!/bin/sh
2remote_display=0
3reverse_connection()
4{
5 display=${DISPLAY#:}
6 display=${display%.*}
7 remote_port=$((58000 + remote_display))
8
9 local_port=$((59000 + display))
10 xvncviewer -listen $((local_port - 5500)) &
11 ssh "$@" -f -R "localhost:$remote_port:localhost:$local_port" -- \
12 x11vnc -q -connect_or_exit localhost:$remote_port -display :$remote_display
13}
14
15direct_connection()
16{
17 export VNC_VIA_CMD=": '%G'; ssh -f -L %L:%H:%R $* -- x11vnc -localhost -q -display $remote_display"
18 xvncviewer -via remote localhost
19}
20
21if [ $# = 0 ]
22then
23 set -- -4 ella@blackboard
24fi
25
26REVERSE=y
27if [ "$REVERSE" ]
28then
29 reverse_connection "$@"
30else
31 direct_connection "$@"
32fi