Bash Script to copy file across network unattended

bashcopycronscpscripting

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?

Best Answer

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" }