1

I would like to create a script that would execute a series of scp commands. This would pull a specific set of files from another computer on the network to a specific directory on the local machine.

What are the authentication considerations of note? I.E. this will end up being a cron job, so what would be the best way to handle the password challenges?

2 Answers 2

2

you can handle the password either by using authorized_keys (ssh-keygen , ssh-copy-id) which is more "automated" an you don't ger prompted for password

The other way is to use expect, which "autofills" the password field (a little configuration is needed) {and generally it works like ... "when you see password field give this password" }

1
  • 2
    key-based auth is probably the easiest/safest, and also will save you from having to store your passwords in the script itself.
    – Sweet
    Aug 16, 2010 at 18:53
2

I would seriously consider using rsync to transfer the files. It will avoid copying the files it the haven't changed, and only pull changes if the file has been changed. This saved me lots of bandwidth and time pulling log files.

rsync can be run as a server on the remote end, or run over ssh.

I would suggest using key-based authentication which ever option you choose.

1
  • I would use this method too. Rsync is a great protocol and works well with SSH Keys.
    – vmfarms
    Aug 17, 2010 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .