I am stuck with some unusual situation and am seeking urgent help.

We have a backend server in C++ on Solaris 5.9 . The need is to intiate a sftp/scp to a remote location. We have the login and passwords set up. I know for non-interactive SFTP/SCP2 sessions we can exchange RSA/DSA keys. But that is not doable in my current business situation between the Prod Support, the other business entity to which we are ftping the files and out IT team.

Is there a way I can pass the password to the scp session? I tried few things that are usually doable in ftp(plain old non scure ftp) like passing the password in batch etc but the same doesnot work for SFTP.

Is there any way I can create a process that can pass the password to the scp command?

Any perlsript(basic perl without net::sftp or other packages [sorry! for the constraints but relations with prod support are not very great] and shell script that can handle this is also possible)

Any help or suggestions in this regard great!!!

Thanks all


Well have you really explored the option if you could get the public key from your peer.
Anyways there is another method. Use "expect".