On our department's UNIX system, I wrote a shell script (called "zap") that slept for 5 minutes, and then, in a loop:
- searched to see if a specified user was logged in
- if so, found which terminal he was using
- sent a "clear screen" signal to his terminal
- slept for 30 seconds
This ran as a background task, even when I was logged off, and was a root process (not associated with my personal userid). It would run until I logged back in and killed it.
So my friend had just logged in. I typed "zap <victimname>", and then logged off and walked over to say hello. While we stood there and chatted, his screen cleared. He looked at it, and then tentatively hit the "enter" key. He got a prompt, so he shrugged it off. After chatting for 30 seconds, it happened again. He assumed the terminal was screwed up, so he logged off and moved to another terminal. And it happened again. And again. And it followed him to every terminal he tried. And of course, no one else was having any problems but him. . .
I did this to him a couple of times for short periods just to annoy him. One time, I left the process running. He'd try to get some work done, see "the problem" happening again, log off and go to class, come back an hour later and try again, see that it was still happening. . .go home and come back the next morning, and it was STILL happening!
Eventually, I called him over to my terminal and showed him the code for "this little program I had written". The look on his face as he figured out what it was, was priceless!
College was so much fun. Another guy edited the code for the "login" procedure to target another person. He added a statement that essentially said "if the id entered by the user is <victimname>, then reject the password as incorrect." When the victim tried to login a second time, he would succeed just fine; the idea was that he would assume his just mistyped it the first time.
However, the code was a little more complex than that: it had a date counter that said "on the second day, reject the password twice." "On the third day, reject the password three times". And so on.
It took the victim about four days before he figured out that something was going on. It took him another three days before it occurred to him that the code for the login procedure has been changed.