Script should wait for password while doing scp

Hi team,

need help on this :- trying to scp a file from A ( it could any server among hundreds not one) server to B server ( fixed ) . The script runs in a third server CFGEngine server.

a. we dont use static password ( its pin + rsa token) so , "here documents" kind of thing is not possible

b. the source server can vary from hundreds of them, so ssh key option is also ruled out.

code :-

ssh  A  'scp  /var/dump/sessions/dump.tgz gsharma@B:/tmp/ '

I want the bash script to wait for password .

You can use expect to interact with scp

not sure how will I incorporate expect script in bash script.

p.s. I dont have static password, every time the pin + password combination would be different. so problem is to accept password from keyboard.

TIA.

I think you just need to add "-t" or "-tt" option to your ssh command.