#!/usr/bin/expect -f
spawn scp -P port_number user@address:/file /home/file
expect { -re ".*sword.*" { exp_send "PASSWORD\r" } }
interact
expect { -re ".*sword.*" { exp_send "PASSWORD\r" } }
interact
It works without asking password to the user if you insert it in the 'PASSWORD' placeholder.
You can schedule as cronjob and you'll have a simply way to backup some of your remote files, maybe logs for later inspection.
Nessun commento:
Posta un commento