How to pass password to scp command in bash script

scp

If you need to use the scp commmand in a bash script, the simplest way is through the tool sshpass:

yaourt -S sshpass

The usage is the follow:

sshpass -p 'password' scp file.tar.gz [email protected]:/PATH

About Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at https://pgp.mit.edu

Leave a Reply

Your email address will not be published.

*