> Hi, all :)
> I'd like to restrict a few users from logging into a specific tty.
> For example, let's say I want to prevent a user "foo" from logging into
> tty02. I know that I can add a few lines in the .kshrc file of "foo" to
> do that, but I'd like to have more "user-proof" solution. Could "login"
> itself do this type of screening? Please, help~
> Big thanks in advance!
You could add names to where the string 'mike' is listed below as to
who _could_ login.
:
############################################################################
### (c) 1995 Lone Star Software Corp. ALL RIGHTS RESERVED ###
### This script must be added to the *BEGINNING* of '/etc/profile' ###
### Restricts login on modem port to selected users. ###
############################################################################
MODEM_TRAP="Y" # sh & ksh
if [ "$MODEM_TRAP" = "Y" ]
then
trap '' 2
Printer="lp -dlaser"
LOG="/tmp/modem$$"
LOGNAME="`logname`"
case `tty` in
/dev/tty2A) case $LOGNAME in
mike) # Allow mike to login at the Modem tty2A
echo "==================================" > $LOG ;
echo " *** Modem Login OK ***" >> $LOG ;
echo "==================================" >> $LOG ;
echo "Date: `date`" >> $LOG ;
echo "ID: $LOGNAME" >> $LOG ;
echo "TTY: `tty`" >> $LOG ;
echo "==================================" >> $LOG ;
cat $LOG | mail -s "Modem Login_OK" root ;
cat $LOG | $Printer ;
rm -f $LOG ;;
*) # No one else gets in.
echo "==================================" > $LOG ;
echo " *** MODEM LOGIN ATTEMPT ***" >> $LOG ;
echo "==================================" >> $LOG ;
echo "Date: `date`" >> $LOG ;
echo "ID: $LOGNAME" >> $LOG ;
echo "TTY: `tty`" >> $LOG ;
echo "==================================" >> $LOG ;
cat $LOG | mail -s "MODEM_ATTEMPT" root mike ;
cat $LOG | $Printer ;
kill -9 $$ ;
exec /bin/true ;;
esac ;;
esac
fi
Hope this helps,
Jeff Hyman, HBW
.--.
__________________________ .-. | | __________________________________
Cactus International, Inc. | |_| | | | Sales: (800) LONE-TAR
13987 W. Annapolis Ct. _ |___ |_| | Support: (301) 829-1622
Mt. Airy, MD 21771 _| ~- | ___| Fax: (301) 829-1623
Jeffrey Hyman \, _} | | FTP: ftp.cactus.com
CompuServe: 74710,2627 \( | | WWW: http://www.cactus.com
------------------------------- | | -----------------------------------
| |