X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Ftty%2Flockem.sh;h=fb781b144d6c4084397a3460c0998164a80f1f08;hb=b6a31e0e31b2fa661518b93e9a1801324d41c265;hp=473e086769529dbdf8d03271b5f628d8d2cbecde;hpb=dd2578e2952b2c73b24a03a94c17974da78e9fed;p=feisty_meow.git 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."