且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

重定向标准输入来自使用bash不同的终端

更新时间:2023-11-18 09:40:40

我怀疑这是不可能的。据我所知,没有在内核空间修改的东西,这是不可能读取一个TTY(或控股)输入的不是当前的tty。甚至根本不能做到这一点。我花了一些时间寻找到这一点,我无法找出如何做到这一点,但我没有找到很多自称来源这是不可能的。这似乎是一个设计决策,以提高用户的安全/隐私。

I suspect this is not possible. AFAIK, without modifying something in kernel space, it's impossible to read the input from a tty (or pty) that is not the current tty. Even root can't do it. I spent some time looking into this and I was unable to find out how to do it, but I did find lots of sources claiming it was impossible. This appears to have been a design decision to increase security/privacy of users.