I know in the good old days of ftp, you could do:
ftp -i -v -n servername <<ENDFTP
user hoss password
binary
ls
bye
ENDFTP
It appears with sftp's authentication mechanism, the passwords are a little harder to exchange.
Now, you have to configure the server ahead of time to consider the source trusted. Use the following steps to make that happen:
create the keys for the origin account, i.e. the account that performs the copy:
$ cd ~/.ssh
$ ssh-keygen -t dsa
You are asked for a passphrase, do not enter a passphrase, type <RET> for empty passphrase.
verify the creation of the 2 files:
~/.ssh/id_dsa
~/.ssh/id_dsa.pub
copy ~/.ssh/id_dsa.pub to the destination node
login into the destination node and verify if file ~/.ssh/authorized_keys is already present, if not do:
$ cd ~/.ssh
$ mv id_dsa.pub authorized_keys
Verify ~/.ssh/authorized_keys and add/replace id_dsa.pub as needed.
Then, run your sftp with a -b extension. This will put it in batch mode and allow it to draw its commands from a text, or batchfile. You need to specify the batch filename after -b.
___________________________________
[morse]--... ...--[/morse], Eric.