I normally use scp
like so:
myUser@myMachine:~/myapp$ scp devops@myserver.org:/path/to/bin/*.derp .
devops@myserver.org's password: ********
herp1.derp 100% 732 0.7KB/s 00:00
herp2.derp 100% 215 0.2KB/s 00:00
herp3.derp 100% 682 0.7KB/s 00:00
myUser@myMachine:~/myapp$
I now want to write a Bash script that, among other things, does this for me, but where the password is stored in the script, and the script doesn't query the user to enter it:
sh dostuff.sh
Just running that should scp
all the *.derp
files to the user's local directory.
So I ask: how can I supply the password to scp
from inside my script? Thanks in advance!