Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!uflorida!travis!brad From: brad@SSD.CSD.HARRIS.COM (Brad Appleton) Newsgroups: comp.unix.misc Subject: Re: A real hack way to "lock my tty" Message-ID: <1097@travis.csd.harris.com> Date: 28 Sep 90 13:56:53 GMT References: <2863@litchi.bbn.com> <2874@idunno.Princeton.EDU> Sender: news@travis.csd.harris.com Organization: Harris Computers Systems Division, Fort Lauderdale,FL Lines: 148 In article <2874@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul John Falstad) writes: >In article <2863@litchi.bbn.com> rsalz@bbn.com (Rich Salz) writes: >>This only works in C-shell derivatives. Type "goto " and >>then enough blank lines to clear the screen. >> >>When you come back, type ":" and RETURN. > >I hope someone tries that at my site so I can type control-D and then >poke around in his account until he comes back to his terminal. > >>As an interesting exercise, type the following lines >> foo: >> csh >> exit >> goto foo > >Interesting. You can break out of it with kill -STOP $$. > >If Lafontaine's elk would spurn Tom Jones, the engine must be our head, the >dining car our esophagus, the guardsvan our left lung, the kettle truck our >shins, the first class compartment the piece of skin at the nape of the neck, >and the level crossing an electric elk called Simon. Ive been using the following lock-script for several years without any problems: NOTE: you will need to physically change all '^M's in the script to be CTRL-M (literally). I changed it to '^' 'M' for the sake of posting (and worrying it might get lost in translation). -------------------------------------------------------------------------------- #!/bin/sh # # lock - Bourne Shell lockscreen utility # # Created 5/19/88 by Brad Appleton # USAGE="usage: lock [-p] [-b] [-f [filename] ]" # # -p set-up a password for future uses of lock # -f get lock-message from file (or use default) # -b use Banner to display lock message # # if -f is not given then the lock message is taken from the command # line ("SCREEN LOCKED" is displayed if no args are given). # # The -p option need only be used the first time lock is invoked. # It will ask for a password, prompt for verification, then write it # to a hidden file with owner-read-only permission. This file is # used to get the password for all following invocations of lock # (unless of course you use -p to reset the password). # # NOTE # ==== # Once the screen is locked you must press a PHYSICAL LINEFEED # to get prompter for the user password. Return will not do it # since the keyboard is in raw mode to disable suspend signals. # (some signals can be caught by trap, others cant). # trap '' 1 2 3 14 15 ## turn off keyboard interrupts set -- `getopt fpb $*` ## parse command options (using getopt - yuck!) for i in $* ; do ## cycle thru opts case $i in -f) fFLAG="TRUE" ; shift;; --) shift; break;; -p) pFLAG="TRUE" ; shift;; -b) bFLAG="TRUE" ; shift;; esac done if [ "$fFLAG" ] ; then ## get name of file to display if [ $# -gt 0 ] ; then filename=$1 shift else filename="$HOME/.msgfile" fi ## if args fi ## if -f stty -echo ## turn echo mode off if [ "$pFLAG" ] ; then ## now get password echo "\nEnter password for locking: " pw=`line` echo "\nRetype password for verification: " verify=`line` if [ ! "$pw" = "$verify" ] ; then echo "+++ Mismatch - no password created +++" stty echo -raw ## turn echo mode back on (kill raw mode) exit 1 else ## create password file cat > $HOME/.lockpw <