--- /dev/null
+#!/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
+
#!/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.
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
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."