cleaned up lockem
authorChris Koeritz <fred@gruntose.com>
Thu, 9 Nov 2017 03:48:53 +0000 (22:48 -0500)
committerChris Koeritz <fred@gruntose.com>
Thu, 9 Nov 2017 03:48:53 +0000 (22:48 -0500)
also more lab work on vnc

experiments/init.d/vncserver.003 [new file with mode: 0755]
scripts/tty/lockem.sh

diff --git a/experiments/init.d/vncserver.003 b/experiments/init.d/vncserver.003
new file mode 100755 (executable)
index 0000000..73bdec0
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fred"
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+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
+
index 473e086769529dbdf8d03271b5f628d8d2cbecde..fb781b144d6c4084397a3460c0998164a80f1f08 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Can be used to lock up a terminal screen until the user enters the correct
-# password.  Pretty sturdy.  Store your password in the file "PASSWORDFILE",
+# password.  Pretty sturdy.  Store your password in the file "PASSWORD_FILE",
 # configured below.
 #
 # Thanks to Kevin Wika for this shell.
@@ -15,27 +15,29 @@ trap '' STOP
 trap '' EXIT
 trap '' TSTP
 
-PASSWORDFILE=$TMP/lockup_password_file
-LOGFILE=$TMP/session-lockup.log
+PASSWORD_FILE=$TMP/lockem.password
+LOG_FILE=$TMP/session-lockem.log
 
-if [ ! -f "$PASSWORDFILE" ]; then
+if [ ! -f "$PASSWORD_FILE" ]; then
   sep
   echo "no password file is configured.  please put your unlock password in:"
-  echo "$PASSWORDFILE"
+  echo "$PASSWORD_FILE"
   sep
   exit 1
 fi
 
-read password <$PASSWORDFILE
+chmod 700 "$PASSWORD_FILE"
 
-echo "$(date_stringer): +++ terminal locked" >>$LOGFILE
+read password <"$PASSWORD_FILE"
+
+echo "$(date_stringer): +++ terminal locked" >>"$LOG_FILE"
 
 attempt=""
 
 stty -echo
 while [[ $attempt != $password ]]; do
   if [ ! -z "$attempt" ]; then
-    echo "$(date_stringer): login attempt with wrong password at $(date)" >>$LOGFILE
+    echo "$(date_stringer): login attempt with wrong password at $(date)" >>$LOG_FILE
   fi
   clear
   nechung
@@ -44,8 +46,8 @@ while [[ $attempt != $password ]]; do
 done
 stty echo
 
-echo "$(date_stringer): successful login" >>$LOGFILE
-echo "$(date_stringer): --- terminal unlocked" >>$LOGFILE
+echo "$(date_stringer): successful login" >>$LOG_FILE
+echo "$(date_stringer): --- terminal unlocked" >>$LOG_FILE
 
 clear
 echo "hi $USER, your password has been accepted.  enjoy your computer."