continuing in vnc lab
authorChris Koeritz <fred@gruntose.com>
Thu, 9 Nov 2017 19:50:40 +0000 (14:50 -0500)
committerChris Koeritz <fred@gruntose.com>
Thu, 9 Nov 2017 19:50:40 +0000 (14:50 -0500)
experiments/home-.vnc/xstartup.012 [new file with mode: 0755]
experiments/init.d/vncserver.005 [new file with mode: 0755]

diff --git a/experiments/home-.vnc/xstartup.012 b/experiments/home-.vnc/xstartup.012
new file mode 100755 (executable)
index 0000000..7e5fc79
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# NOTE: it is important to be running the vncserver as a user who is NOT
+#        already running x windowing system.  otherwise, weird and possibly
+#        bad things can happen, e.g. your apps show up on display zero
+#        rather than on the vnc desktop.
+
+# this script depends on the gnome desktop.  to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+#
+#   sudo apt-get install gnome-panel gnome-settings-daemon gnome-terminal kwalletmanager metacity nautilus
+
+# references:
+#
+#   best leads: https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+#
+#   https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+#   https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+#   https://ubuntuforums.org/showthread.php?t=1903220
+#   https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# reset some variables that could be a problem.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+
+############################
+
+# load some extra configuration files if they exist.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+############################
+
+# set background to solid color; avoids using bandwidth to transfer pictures.
+xsetroot -solid darkgreen
+#this does what again?
+vncconfig -iconic &
+
+############################
+
+# solid leads from the "best" article above gave us the workable, minimal set
+# of x window apps below.
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+/usr/bin/metacity &
+/usr/bin/nautilus &
+/usr/bin/gnome-terminal &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:</~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:</~`|#=;" !!!!
+# ------------------------------
+
+# all content has been deleted from the config dungeon.  the damaged configs
+# have been set free to roam in their natural environment of the internet.
+
diff --git a/experiments/init.d/vncserver.005 b/experiments/init.d/vncserver.005
new file mode 100755 (executable)
index 0000000..5cf5e2b
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fredhuff"
+# fredhuff is a different user than my normal user who is logged in on
+# desktop zero.  this is important for display isolation.
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+XAUTHORITY="/home/$USER/.Xauthority.vnc"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+