I know it is not recommended, but is it at all possible to pass the user's password to scp?
I'd like to copy a file via scp as part of a batch job and the receiving server does, of course, need a password and, no, I cannot easily change that to key-based authentication.
Best Answer
Use sshpass:
or so the password does not show in the bash history
The above copies contents of path from the remote host to your local.
Install :
apt install sshpass
yum install sshpass
port install sshpass
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb