Get a site

How to pass password to scp command in bash script


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

Published by 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

Leave a Reply

Your email address will not be published.

%d bloggers like this: