Can the output to a terminal be monitored?

Thomas Omerzu omerzu at quando.UUCP
Sat Jun 9 20:08:46 AEST 1990


In article <270 at demott.COM> kdq at demott.COM (Kevin D. Quitt) writes:
>
>Is there a way that I (as root) can "tap into" a user to monitor
>terminal activity?  I specifcally would like to do this for the modem line.
>

I'm using a modified version of the Berkley `script', which was
recently posted on the net.
That version was intended as a `tutor' support, and sends it output
immediately to one ore more terminals.
I did some further modifications, which allow to switch monitoring
on and off.

My approach:
The login shell on the modem line is replaced by a modified version
of `script', called `bbs0'.
It allocates an pty, forks twice for copying in- and output from
modem to pty and vice versa,
creates a fifo and execs `bbs1' on the corresponding virtual tty.
`bbs1' can be any program, e.g. a user menu or a simple shell.
At first the copying is only done between pty and virtty.
But when I send a SIGUSR1 to the copy processes, they
start to duplicate everything they get to the fifo.
A `cat < fifo' will show the session on your screen.
When you stop the `cat', the copy processes will receive a SIGPIPE
and they stop copying to the fifo.

This seems to work quite well.
The problems reported by  bill at twg.UUCP (Bill Irwin) in <165 at twg.UUCP>
concerning his `tee' version and vi or raw mode seem to not occur.
Naturally, the requirement for the same terminal type for monitoring
and login session does also apply to this solution.

Some problems seem to come up when you have want to use software
handshake on the modem line, since `bbs0' requires to set
the modem line in raw mode.
I did not yet find an appropriate solution for this.


--
	Thomas Omerzu, omerzu at quando.quantum.de



More information about the Comp.unix.questions mailing list