How can I create a loop between two TTYs? How can I create a loop between two TTYs? unix unix

How can I create a loop between two TTYs?


When you send your echo command to /dev/pts/0 you are literally just sending the output of that echo to the other TTY's output - you are not sending it to the other TTY's input buffers. Therefore your nested echo command will simply be displayed on the other TTY, but not executed.

There is an ioctl() call TIOCSTI which can be used to fake input on another TTY, but only if you have "write" permission to that other TTY.

Many years ago I recall that some friends and I discovered holes on some versions of UNIX which didn't correctly enforce the security permissions on TIOCSTI. If root had left a terminal logged in somewhere it was possible to make the root user's terminal type in commands on your behalf...