aboutsummaryrefslogtreecommitdiff
path: root/vnc
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-08-20 20:44:34 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-08-20 20:44:34 -0300
commite851401694daacaf1aba2c87ed557e5dbf00af02 (patch)
treed772b15f3a5ba9e015936f7162f448a7208a4001 /vnc
parentd6a4d78d31ffa57e00a7d5b0a87baa38156cee06 (diff)
downloadscripts-e851401694daacaf1aba2c87ed557e5dbf00af02.tar.gz
scripts-e851401694daacaf1aba2c87ed557e5dbf00af02.tar.bz2
Move scripts to other repositories
Diffstat (limited to 'vnc')
-rwxr-xr-xvnc80
1 files changed, 0 insertions, 80 deletions
diff --git a/vnc b/vnc
deleted file mode 100755
index 94ce3d6..0000000
--- a/vnc
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-#
-# Wrapper around ssh and vncviewer
-#
-
-# Parameters
-BASENAME="`basename $0`"
-SERVER="$1"
-LOCALPORT="${2:-5901}"
-REMOTEPORT="${3:-5901}"
-
-# Clipboard options
-# In practice, clipboard limitations are not working as expected
-# So please do not use this script if you don't want to automatically share clipboard with the remote system
-# This is probably a bug on xtigervncviewer
-VIEWER_OPTS="-AcceptClipboard=off -SendClipboard=off -SetPrimary=off -SendPrimary=off"
-
-function usage {
- echo "usage: $BASENAME <server> [localport] [remoteport]"
- cat <<EOF
-
-setup instructions
-==================
-
-* in the remote:
-
- sudo apt install tigervnc-standalone-server # install in the remote server
- vncpasswd # generate a ~/.vnc/passwd in the remote server
-
-* in the local box:
-
- scp <server>:~/.vnc/passwd ~/.vnc/<server>.passwd # copy the secret
- $BASENAME <server> # use our magic script to do everything else
-
-EOF
-
- exit 1
-}
-
-# Usage
-if [ "$1" == "--help" ]; then
- usage
-fi
-
-# Check
-if [ -z "$SERVER" ]; then
- if [ -h "$HOME/.vnc/default.passwd" ]; then
- SERVER="$(basename `readlink $HOME/.vnc/default.passwd` .passwd)"
- else
- usage
- fi
-fi
-
-# Check if vncserver is running in the remote server and start otherwise
-ssh $SERVER <<EOF
- HOSTNAME="\$(cat /etc/hostname)"
-
- if [ -e "\$HOME/.vnc/\$HOSTNAME:1.pid" ]; then
- PID="\$(cat \$HOME/.vnc/\$HOSTNAME:1.pid)"
-
- if ! ps \$PID &> /dev/null; then
- /usr/bin/vncserver -alwaysshared -dpi 96 -localhost :1
- fi
- else
- /usr/bin/vncserver -alwaysshared -dpi 96 -localhost :1
- fi
-EOF
-
-# See http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/
-# Optional SSH compression
-#ssh -C -c blowfish -f -L 5901:127.0.0.1:5901 $SERVER sleep 10
-ssh -f -L $LOCALPORT:127.0.0.1:$REMOTEPORT $SERVER sleep 10
-
-# Run VNC client
-# Copy $SERVER:~/.vnc/passwd into $HOME/.vnc/$SERVER.passwd for passwordless login
-if [ -e "$HOME/.vnc/$SERVER.passwd" ]; then
- vncviewer $VIEWER_OPTS -passwd $HOME/.vnc/$SERVER.passwd localhost:$LOCALPORT
-else
- vncviewer $VIEWER_OPTS localhost:$LOCALPORT
-fi