home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / shell / 3466 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  975 b 

  1. Path: sparky!uunet!utcsri!bonnie.concordia.ca!daily-planet.concordia.ca!alcor.Concordia.CA!gsa
  2. From: gsa@alcor.concordia.ca ( CON U GRADUATE STUDENTS' ASSOC )
  3. Newsgroups: comp.unix.shell
  4. Subject: Password protection for terminal via shell.
  5. Message-ID: <4734@daily-planet.concordia.ca>
  6. Date: 12 Aug 92 16:58:53 GMT
  7. References: <1992Aug3.165658.7658@novell.com> <FRIEDMAN.92Aug3194104@nutrimat.gnu.ai.mit.edu>
  8. Sender: usenet@daily-planet.concordia.ca
  9. Organization: Concordia University, Montreal, Quebec
  10. Lines: 26
  11.  
  12. Someone sent me a shell script that is supposed to password
  13. protect your terminal, yet for some reason it doesn't seem
  14. to be working.  Can someone tell me what's wrong with this?
  15.  
  16. :
  17. #
  18. trap "echo Working on Process;stty echo;kill $$" 2 15
  19. SECRET="secret"
  20. stty -echo
  21. echo "Lock string: \c"
  22. read BUF1
  23. echo
  24. while :
  25. do
  26.  BUF2= `line < /dev/tty`
  27. if [ "$BUF2" = "$BUF1" ]
  28. then break
  29. elif [ "$BUF2" = "$SECRET" ]
  30. then break
  31. fi
  32. echo "^G\c"
  33. done
  34. stty echo
  35.  
  36. ---------
  37. Dan.
  38.