How to enable sshpass output to console

After

sudo apt-get install expect

the file send-files.exp works as desired:

#!/usr/bin/expect -f

spawn scp -r $FILES $DEST
match_max 100000
expect "*?assword:*"
send -- "12345\r"
expect eof

Not exactly what was desired, but better than silence:

SSHPASS="12345" sshpass -e  scp -v -r $FILES $DEST 2>&1 | grep -v debug1

Note that -e is considered a bit safer than -p.

Output:

Executing: program /usr/bin/ssh host servername, user username, command scp -v -t /src/path/dst_file.txt
OpenSSH_6.6.1, OpenSSL 1.0.1i-fips 6 Aug 2014
Authenticated to servername ([10.11.12.13]:22).
Sending file modes: C0600 590493 src_file.txt
Sink: C0600 590493 src_file.txt
Transferred: sent 594696, received 2600 bytes, in 0.1 seconds
Bytes per second: sent 8920671.8, received 39001.0

In this way:

output=$(sshpass -p $PASSWD scp -v $filename [email protected]:/root 2>&1)

echo "Output = $output"

you redirect the console output in variable output.

Or, if you only want to see the console output of scp command, you should add only -v command in your ssh pass cmd:

sshpass -p $PASSWD scp -v $filename [email protected]:/root