Abandoned shell

andrew.b.myers abm at cbnewsm.att.com
Sun Dec 9 13:00:43 AEST 1990


What's the best sure-fire way to kill a login shell instantaneously
if a user disconnects "ungracefully"?  I'm sure anyone who knows
anything about system administration can help me.  I just don't
happen to know anything about system administration.

Here's the setup:  I've got a 3B2-300 running UNIX 3.0.  I've created
a restricted login (/bin/rsh) called "go" with no password required.
The login prompt tells the user to type 'go' which sets everything in
motion.

The .profile executes a shell script that I have bullet-proofed
every way but Sunday, so "go" can't escape and mess around in UNIX.
This is going to be a simple bulletin board open to anyone who wants
to scan files in a directory I've set up.  As I said, the last line
in go's .profile is

     exec /usr/my_bin/my_script

where my_bin is a directory I created just for this script and related
utilities and my_script is the shell script user interface I wrote for
scanning files a la CompuServe or similar bulletin boards.  I under-
stand that exec causes the original login shell to die and a new shell
is spawned as the my_script program kicks in.

Right now I'm testing it with a single 1200 baud dialup port coming in
through a Hayes modem.  Everything works fine except when 'go' simply
disconnects without actually quitting, something I suspect many users
will do.  The new shell created by exec just keeps going.  When the next
user dials up to the same port, he/she gets this munged shell instead of
a fresh login prompt.  Because some child processes were killed off when
the previous user suddenly disconnected, the whole thing is a mess.

So now I need an instantaneous sledge hammer to kill the abandoned
shell when a user suddenly drops off.

This behavior is completely repeatable.  If I look for living processes
after an "ungraceful" disconnect I always find that same tty running
the leftover shell.  A who -uT not only indicates Mr. "go" still logged
in, but active!  Therefore my idle user script (which works fine
otherwise) won't kill the abandoned login.

Could this abandoned-but-active shell be related to the fact that the
port is connected to a modem?  Is there anything I can do with the Hayes
to prevent this behavior?  Is there some kind of UNIX deamon anyone has
to keep watch over this and kill an abandoned shell?  Is the problem
related to /bin/rsh?  Is there a better way to set up a simple "public"
bulletin board?  Any advice welcome...

Thanks in advance and don't bother posting.  Please email to att!brpr04!abm

--andy myers--
-- 
========================================================================
 Andrew Myers            AT&T, Basking Ridge, NJ     ...attmail!abmyers
 Public Relations             201-221-2737            ...att!brpr04!abm
========================================================================



More information about the Comp.unix.admin mailing list