Use sshpass :
ssh
uses direct TTY access to make sure that the password is indeed issued by an interactive keyboard user.sshpass
runsssh
in a dedicated tty, fooling it into thinking it is getting the password from an interactive user.
sshpass -p 'password' scp -r [email protected]:/some/remote/path /some/local/path
Você também pode usar sshpass
com ssh
, rsync
e scp
.