Control stdin/stdout of an other program.. How can I do that ?



Hi,
I know that ssh keys exists.. I know about ssh_agent and all these
things..
But I'm limited in my environment and I won't be able to change
these things to put an ssh key everywhere.

What I want to do is connect to a list of servers via ssh (OpenSSH)
and only get prompted for the password once (assuming the password is
the same for all the servers).

I would like my program to start ssh, get the "password:" prompt and
then issue the password. Once this is done, leave the session to me.
Like if I could send keys to a system() call.
Actually, this thing will be used to issue commands to many servers
at the same time to do basic administration.. like creating a user on
many systems.

I've seen in the past some softwares reading/writing to the passwd
command.. for example P-Synch from MTechIT.. the problem is that I
haven't seen the source code and I'm having problems finding what I am
looking for with the stdin/stdout/read/write keywords..

Anyone can refer me to an open source application that do soemthing
similar or a basic script example.

PS: I'm planning on developping in c/c++ on an AIX 5L environment

Thanks,
--Benoit Lefebvre

.