I am wanting to use expect to automate the copying of files from one system to another with scp, the secure copy command. Below is the syntax of my scp command:
% scp username@host_a:filename filename
This then gives me the following prompt:
I want to use expect to automate the entering of the password, but I can't figure out how to do this. I'm aware of some security flaws with this approach and am taking some measures to reduce the risks. Below is the expect script I have written so far:
set timeout 3600
spawn /usr/local/SSH/bin/scp user@server1:setEnv.sh /tmp/setEnv.sh
My understanding of expect is quite rudimentary, but I am hoping to be able to work this out. A correction to this script, or a very similar script which leads me to the solution would be great.