From: Chris Koeritz Date: Thu, 9 Nov 2017 03:48:53 +0000 (-0500) Subject: cleaned up lockem X-Git-Tag: 2.140.90~33 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=8dda06c8114ad854c0183cfdbf112da2713a417b cleaned up lockem also more lab work on vnc --- diff --git a/experiments/init.d/vncserver.003 b/experiments/init.d/vncserver.003 new file mode 100755 index 00000000..73bdec08 --- /dev/null +++ b/experiments/init.d/vncserver.003 @@ -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 + diff --git a/scripts/tty/lockem.sh b/scripts/tty/lockem.sh index 473e0867..fb781b14 100644 --- a/scripts/tty/lockem.sh +++ b/scripts/tty/lockem.sh @@ -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."