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?

  • 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? – Ƭᴇcʜιᴇ007 Jul 11 '14 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 '14 at 1:59
4

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.

| improve this answer | |
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.