1

I see a similar question on stackoverflow:

https://stackoverflow.com/questions/1353253/linux-terminal-how-to-capture-or-watch-other-terminal-session

Someone recommends conspy. However, it seems that conspy doesn't work for pts terminal.

I also tried the way to use strace to get the keys pressed here, but I found the result quite difficult to read.

Does anyone have ideas about this?

2
  • Have you tried any of the other suggested answers on that link SO question? There are several different ideas/approaches suggested. Which have you tried? What were the results? Jul 11, 2014 at 17:15
  • @techie007 tried every answer in the SO questions, but almost none works. The cat /dev/pts/xx works, but it will make the user's shell behave wierdly
    – Firegun
    Jul 12, 2014 at 1:59

2 Answers 2

5

This works (kinda) for me:

tty=pts/0
sudo peekfd -8cnd $(ps -fat | grep "$tty *Ss" | awk '{print$1}') 0 1 2

Replace pts/0 with the TTY of the user you want to watch. This will NOT work perfectly for everything, but it works with most input/output.

0

ttysnoop is what you're looking for. It's been years since I've used it, so I'm not sure it works on modern kernels. You'll have to do some research to get it working. But if you do, please let me know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .