summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon GECOS <u@adam>2023-05-31 20:54:28 -0400
committerGordon GECOS <u@adam>2023-05-31 20:54:28 -0400
commit25911a0cb2569dcdbbcc4ac49f05addb9d9f74a5 (patch)
treed2512e69ca0940564103d99e723d40e7d3e1f6f4
parentc0a0041f01536a968584234a65e2140ad4f76343 (diff)
also old changes
-rwxr-xr-xxvnc17
1 files changed, 15 insertions, 2 deletions
diff --git a/xvnc b/xvnc
index 649580a..caebfe8 100755
--- a/xvnc
+++ b/xvnc
@@ -1,4 +1,10 @@
1#!/bin/sh 1#!/bin/sh
2# TODO: create systemd service for ssh-x11vnc@ with dependency service
3# xvncviewer@
4#
5# Restrict connections to the port opened by ssh in xvncviewer@ to the
6# corresponding ssh-x11vnc@ service.
7
2remote_display=0 8remote_display=0
3reverse_connection() 9reverse_connection()
4{ 10{
@@ -7,9 +13,16 @@ reverse_connection()
7 remote_port=$((58000 + remote_display)) 13 remote_port=$((58000 + remote_display))
8 14
9 local_port=$((59000 + display)) 15 local_port=$((59000 + display))
16 fuser -vk $local_port/tcp
10 xvncviewer -listen $((local_port - 5500)) & 17 xvncviewer -listen $((local_port - 5500)) &
11 ssh "$@" -f -R "localhost:$remote_port:localhost:$local_port" -- \ 18 pid=$!
12 x11vnc -q -connect_or_exit localhost:$remote_port -display :$remote_display 19 (
20 remote_display_arg=${remote_display:+ -display :$remote_display}
21 set -x
22 ssh "$@" -n -R "localhost:$remote_port:localhost:$local_port" -- \
23 x11vnc -q -connect_or_exit localhost:$remote_port ${remote_display_arg:- -find}
24 )
25 kill $pid
13} 26}
14 27
15direct_connection() 28direct_connection()