> On Dec 3, 2018, at 16:01, Asad <[email protected]> wrote:
>
> Hi All ,
>
> I am looking for a solution to automate downloading file using sftp
> process using :
>
> batch.txt :contains the following two lines
> cd 12345678
> get 12345678_1.zip
>
>
> import subprocess
> host="abc.com"
> user="sa"
> user_host="%s@%s" % (user, host)
> sftp_process = subprocess.Popen(['sftp', '-b', 'batch.txt', user_host],
> shell=False)
>
> however it gives error even unable to provide password .
batch mode for sftp assumes you don’t need a password. From the manage:
-b batchfile
Batch mode reads a series of commands from an input batchfile
instead of stdin.
Since it lacks user interaction it should be used in conjunction
with non-inter‐
active authentication.
You would need to set up an ssh key with a null passphrase, or set up an
ssh-agent in order for that to work.
Another option would be to use pexpect to automate console input
—
David Rock
[email protected]
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor