PDA

View Full Version : Listen to stdio of child process in parent



nitinmhetre
12-20-2006, 06:18 AM
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

jim mcnamara
12-20-2006, 08:52 AM
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.

Perspective
12-20-2006, 09:16 AM
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 ;)