summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-07-23 15:49:09 -0400
committerAndrew Cady <d@jerkface.net>2023-07-23 15:49:09 -0400
commitfe42a3a25adcfa551a959b5002ab71998f55a548 (patch)
treee17b509e047c6901f45877f97326d5c85fc04f85
parent25911a0cb2569dcdbbcc4ac49f05addb9d9f74a5 (diff)
committing old workHEADmaster
-rwxr-xr-xxvnc12
1 files changed, 9 insertions, 3 deletions
diff --git a/xvnc b/xvnc
index caebfe8..318c3a9 100755
--- a/xvnc
+++ b/xvnc
@@ -5,16 +5,22 @@
5# Restrict connections to the port opened by ssh in xvncviewer@ to the 5# Restrict connections to the port opened by ssh in xvncviewer@ to the
6# corresponding ssh-x11vnc@ service. 6# corresponding ssh-x11vnc@ service.
7 7
8xvncviewer=xtightvncviewer
9
8remote_display=0 10remote_display=0
11if [ "$REMOTE_DISPLAY" ]
12then
13 remote_display=$REMOTE_DISPLAY
14fi
9reverse_connection() 15reverse_connection()
10{ 16{
11 display=${DISPLAY#:} 17 display=${DISPLAY#:}
12 display=${display%.*} 18 display=${display%.*}
13 remote_port=$((58000 + remote_display)) 19 remote_port=$((58000))
14 20
15 local_port=$((59000 + display)) 21 local_port=$((59000 + display))
16 fuser -vk $local_port/tcp 22 fuser -vk $local_port/tcp
17 xvncviewer -listen $((local_port - 5500)) & 23 $xvncviewer -listen $((local_port - 5500)) &
18 pid=$! 24 pid=$!
19 ( 25 (
20 remote_display_arg=${remote_display:+ -display :$remote_display} 26 remote_display_arg=${remote_display:+ -display :$remote_display}
@@ -28,7 +34,7 @@ reverse_connection()
28direct_connection() 34direct_connection()
29{ 35{
30 export VNC_VIA_CMD=": '%G'; ssh -f -L %L:%H:%R $* -- x11vnc -localhost -q -display $remote_display" 36 export VNC_VIA_CMD=": '%G'; ssh -f -L %L:%H:%R $* -- x11vnc -localhost -q -display $remote_display"
31 xvncviewer -via remote localhost 37 $xvncviewer -via remote localhost
32} 38}
33 39
34if [ $# = 0 ] 40if [ $# = 0 ]