I didn't know this either. If I had to hazard a guess, I'd say the
other file descriptors correspond to stdout and stderr along with
other fds the process has open()ed. I may use this in the future,
thanks for the info!
On 10/1/09, draeath <draeath@gmail.com> wrote:
> Hey all,
>
> This problem had come up for me, and someone on IRC helped me find
> this interesting functionality.
>
> It's possible to send data to STDIN of arbitrary processes!
>
> In my example, the Debian installer was hanging as the aptitude child
> process was awaiting a "Yes" confirmation to continue. Since aptitude
> was run by the installer scripts, there was seemingly no way to
> provide this response....
>
> I used 'ps' to find the aptitude process ID, which for this example we
> will assume is "1337"
>
> I needed to send the text "Yes" followed by a return. I was root,
> which you would probably need to be (or be the user who 'owns' the
> process).
>
> Code:
> echo Yes > /proc/1337/fd/0
>
> If you don't want to send the return (newline) use "echo -n" as such:
> echo -n Yes > /proc/1337/fd/0
>
> Now, there are lots of other file descriptors under /proc/<PID>/fd and
> there's also a /proc/<PID>/fdinfo/ tree, but I do not know the
> function of these.
>
> Anyways, this is a neat, apparently not-well-known functionality! Enjoy!
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service by Networked
> Knowledge Systems (NKS). Views and opinions expressed in messages
> posted are those of the author and do not necessarily reflect the
> official policy or position of NKS or any of its employees.
>
-- Sent from my mobile device"The power of the computer is marvelous, and the cost of computer power is small, and you can over time build files that have lots of information on them about people's past preferences, and prejudices, and living patterns." K.R. 1999 ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:44:57 EDT