This question already has an answer here:

I have the below line in a script. When I run it, it prompts for a password to copy files in the server. I need the password to be taken from the script.

for i in cat forwarders
do scp -o StrictHostKeyChecking=no $filename $tarfile badgeid@$i:/tmp;

marked as duplicate by Gilles, jimmij, Jeff Schaller, vonbrand, Scott Jan 9 '16 at 0:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I suggest you to check expect command. A similar situation (with ssh) should look like ...

spawn ssh [lindex $argv 1]@root@[lindex $argv 0]@x.y.z.j -tt
expect "*?assword" {
   send "$PASSWORD\r"

Not the answer you're looking for? Browse other questions tagged or ask your own question.