Listen to stdio of child process in parent

This is a discussion on Listen to stdio of child process in parent within the Linux Programming forums, part of the Platform Specific Boards category; Hi , I am facing one problem.I have created a two way pipe between program and scp session. I want ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    28

    Listen to stdio of child process in parent

    Hi ,
    I am facing one problem.I have created a two way pipe between program and scp session.
    I want to listen to the password prompt given by the scp session.
    I have invoked scp session by popen("scp from to","r") in child.
    So I want my parent process to listen for password prompt given by child.Please give any hint.
    I hope I will get help from intellligent members of this forum, because I have got lot of help from this forum uptill now.

    Thank You,
    Nitin

  2. #2
    .
    Join Date
    Nov 2003
    Posts
    307
    popen works one way only. You chose "r", which means read stdout from the child process.
    You cannot "give" the process a password because the pipe is one way.

    If you are using scp, you should have set up authorization keys on the remote nodes, just like for ssh. Otherwise, use rcp.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Suggestion 1: Follow jim's advice and set up your ssh keys
    Suggestion 2: Write an expect script instead of a C program.


    >You cannot "give" the process a password because the pipe is one way

    unless he's using Solaris

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inter process communcation, parent - child
    By tallan in forum C Programming
    Replies: 5
    Last Post: 02-28-2009, 03:04 AM
  2. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 01:14 PM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  5. Sending a message to parent from child process
    By maxorator in forum C++ Programming
    Replies: 2
    Last Post: 10-09-2005, 04:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21