SCP script

Eric R. rossiter at discoverynet.com
Tue Dec 3 22:32:14 CST 2002


Brad Crotchett wrote:
> Hi all,
> 
> I am trying to write a script that will run under cron and scp a file
> from one server to another at night.  I can run this command manually
> just fine and it works:
> 
> 	scp root at server1:/path_to_file /path_to_file_on_server2
> 
> But when I put it in an expect script, it looks like it is launching
> scp, but it never prompts for a password and just hangs there.  Here is
> the expect script:
> 
> send " scp root at server1:/path_to_file /path_to_file_on_server2r"
> expect "root at server1's password:"
> send "passwordr"
> 
> Am I missing something?  Any help is appreciated.
> 
> Brad
> 
> 

Hi Brad,

Try adding -qBC to your scp command.  (scp -qBC ... ) will disable 
prompting for passwords.

You're utilizing expect simply to feed scp the required password right?

The above works nightly for me, scp's backed up files accross town 
running straight out of a bash script fired from cron.  Doesn't prompt 
for password, and resolves the "no controlling tty" issue.

HTH,
E




More information about the Kclug mailing list