Automate scp command using sshpass

Posted on 11-07-2018 by Nadir Latif


Source: http://serverfault.com/questions/318474/how-to-pass-password-to-scp-command-used-in-bash-script

To use the scp command non-interactively, for example in a script, we can use the sshpass utility.

The following command can be used to copy a file to a remote server:

sshpass -p '{password}' scp {source_file_name} {remote_user}@{remote_server}:{remote_server_path}