Looking for Software to Lock T

SGT Paul H. Reyes reyes at tincan-sawyer.af.mil
Sat Jun 22 06:28:13 AEST 1991


> Carla send:
> 
> Does anyone know of any software that runs on an UNIX system that
> will guard an unattended terminal against unauthorized use.  This
> software should clear the terminal screen and not reactivate the
> terminal screen until the correct password is entered.  
> 
> If anybody has any knowledge of any software that will do the above,
> please let me know.
> 
> Thank you,
> Carla Bazemore 
> bazemore at ccf.nrl.navy.mil
> 

Me and my other system administrators are on a UNIX SYSTEM V RUNNING v3.2.2
We have a script that works great for that particular purpose.


Program name: "lock"
------------------------------------cut here----------------------------------
#! /bin/sh
# Created by SYSTEM ADMINISTRATOR 
#            Richard Wachter
#            2001 CS/SCOQ
#            K.I. SAWYER AFB, MI 49843
#            AV -> 472-1398/2544
#            COMM -> 1-906-346-1398
#            TELNET -> 132.39.2.1
#            EMAIL -> root at tincan-sawyer.af.mil
#            EMAIL -> rich at tincan-sawyer.af.mil
#            EMAIL -> reyes at tincan-sawyer.af.mil
#
# Locks keyboard until proper password is given
#
#
name=`awk -F: '$1 ~ /'$LOGNAME'/ { print $5 }' < /etc/passwd`

stty -echo
trap "continue" 0 1 2 3 9 15
while stty -echo ;  do
  echo "^[[2J^[[1;1HEnter Password:^[[12;29HPress <^[[1mRETURN^[[0m> to exit.^[[1;17H\c"
  read "pwd1"
  if [ "$pwd1" != "" ] ; then 
    echo "^[[3;1HRe-Enter Password: \c"
    read pwd2
    if [ "$pwd1" != "$pwd2" ] ; then
      echo "^[[5;1HEntries do not match. Try again."
      sleep 2
      echo "^[[5;1H^[[2K\c"
    else
      break
    fi
  else
    echo "^[[2J^[[1;1H\c"
    stty echo
    exit
fi
done
echo "^[[2J^[[08;5H*****************************************************************
^[[09;5H*^[[09;69H*^[[10;5H*^[[10;10HYou have now locked your terminal^[[10;69H*
^[[11;5H*^[[11;69H*^[[12;5H*****************************************************************
^[[13;5H*^[[13;69H*^[[14;5H*^[[14;10H$name has locked this terminal^[[14;69H*
^[[15;5H*^[[15;69H*^[[16;5H*****************************************************************"
trap "" 2 3
while :
do
  echo "\n    To unlock terminal, enter password: \c"
  read pwd3
  pwd3=`echo $pwd3 | sed -e "s/\!//" -e "s/(//"`
  if [ "$pwd3" = "$pwd1" ] ; then
    stty echo
    echo " "
    exit
  else
    echo "\n     Passwords do not match. \n"
    continue
  fi
done
------------------------------------cut here----------------------------------

The file above contains "^[" characters that are suppose to be an escape code,
not a "^" then a "[".  We use the escape codes are used to turn bold on and
position the cursor at different locations.  Before you run the file above ...
"vi lock" and run this substitution command.

                                 ":1,$s/\^\[/^v^[/g"
                                        |||| |  |
      Backslash to search for a        _|||| |  |
      carrot.                            ||| |  |
                                         ||| |  |
      this is a carrot character "^" .  _||| |  |
                                          || |  |
      Backslash to search for a         __|| |  |
      bracket.                             | |  |
                                           | |  |
     this is a bracket character "[" .   __| |  |
                                             |  |
            this is a control v input.   ____|  |
  the character that will be displayed          |
  is a "^" and will disappear with the          |
  next input.                                   |
                                                |
   entered by pressing the escape key.   _______|

if you try to enter the escape key by itself you will exit insert mode or 
command line execution, so you need to press control v first so "vi" knows
to take the next character literally.


**** If you already know this stuff, I am sorry to take up so much space.

-- 
&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
% SGT Paul H. Reyes                       (DSN) 472-1398                      & 
% 3B2 System Administrator                (COMM)906-346-1398                  &
% 2001 CS / SCOQ                          Telnet Address = 132.39.2.1         &
% K.I. Sawyer AFB                         Email -> reyes at tincan-sawyer.af.mil &
% Michigan 49843                          Modem (906) 346-2952 (autobaud)     &
&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&



More information about the Comp.unix.questions mailing list