Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!husc6!unix!ace!ric From: ric@ace.sri.com (Richard Steinberger) Newsgroups: comp.lang.c Subject: Locking a terminal Summary: Shell script to lock a term Keywords: lock, tty Message-ID: Date: 6 Sep 90 15:40:31 GMT Sender: news@unix.SRI.COM Lines: 41 Someone posted a C program to lock a TTY. Here is a shell script that does the same thing. I got much of this from a popular Unix book, Sobell's Practical Guide to the Unix System. (Don't leave home without it. The 2nd edition has this script on p 261, but fails to trap ^Z!). Note that the trap and stty commands are used to lock out ^C and ^Z. regards, ric steinberger ------------------------------cut here-------------------------------- #!/bin/sh # Lock a TTY trap '' 1 2 3 15 stty -echo susp '' echo -n "Password: " read pw_1 echo echo -n "Again: " read pw_2 echo pw_3= #set to null string if [ "$pw_1" = "$pw_2" ] then until [ "$pw_3" = "$pw_2" ] do echo -n "Lock Password: " read pw_3 echo done else echo "Lock passwords do not match." fi stty echo susp '^Z'