unix system enhancements

Ian Donaldson rcodi at yabbie.rmit.oz
Sun Sep 28 05:36:34 AEST 1986


In article <4120 at brl-smoke.ARPA>, Geoffm at AFSC-HQ.arpa (USAFA) writes:
> 
> 	3.  And lastly modify the tty driver to support "advising."  This would
> 	allow root to watch the characters sent to a terminal and have the
> 	characters that he types inserted into that port's input characte
> 	stream.

Under 4.2, you could do this easily by having the user type:

	script /dev/ttyxx

where ttyxx is the tty that you are logged onto.  This would enable
you to see what the user is doing.  Funny things would happen of course
if the user jumped into vi, and you had a different terminal type :-)

You would have to modify script to do non-buffered writes if the
file mentioned was a tty, otherwise you won't see things immediatly when the
user types them (script uses fwrite(3) to write to the file, and
stdio in all its wisdom doesn't determine optimial buffering for anything
other than stdout when it first writes to it).

You could say:
	if(isatty(fileno(fscript))) 
		setbuf(fscript, NULL);

or some such, after the fscript = fopen(...) line.

As far as you typing input on his tty, it could be done on most versions
of 4.2 and some versions of 4.1, but that is currently a security hole, and
is best left alone (or even better: fixed)

It is without saying that this is something that should be done ONLY with 
consent of the user.

Ian Donaldson



More information about the Comp.unix.wizards mailing list