Submitted 07-Sep-00 by Ron Johnson, Jr.:
> Would it be easier, if not foolproof, to enforce single-login
> on dumb serial terminals?
Certainly. You restrict all users to using a common shell (we'll use bash,
for this example) and source a watchdog script from the global login
configuration file (/etc/profile). The watchdog script could be similar to
the following one liner:
[ $(who | grep ${USER} | awk '{print $1}' | wc -l | sed -e 's/ //g') != 1 ] && exit
Essentially, it immediately logs out any login attempts beyond the first.
A slightly prettier version ( from the user's perspective) would be:
MaxLogs=1
Logins=$(who | grep ${USER} | awk '{print $1}' | wc -l | sed -e 's/ //g')
[ ${Logins} != ${MaxLogs} ] && {
echo This is login ${Logins} of ${MaxLogs} permitted.
exit
}
Note that this *will* detect Eterm, gnome-terminal, and rxvt as discrete
users (the terminal is opened as /dev/pts/?). xterm and konsole apparently
do not handle things in a sufficiently similar manner for this to catch them
(no pty).
--
Anton Graham GPG ID: 0x18F78541
<[EMAIL PROTECTED]> RSA key available upon request
There are three rules for writing a novel. Unfortunately, no one knows what
they are.
-- Somerset Maugham