Hi All,

        I get the following error :

>>> sftp_process = subprocess.Popen(['sftp', '-b', 'batch.txt', user_host],
shell=False)
>>>

Permission denied (keyboard-interactive,publickey,password).
Connection closed

Is there any other way to acheive this because I cannot import pexcept
module .

Thanks,


>
>
> ---------- Forwarded message ----------
> From: David Rock <da...@graniteweb.com>
> To: Tutor Python <tutor@python.org>
> Cc:
> Bcc:
> Date: Mon, 3 Dec 2018 18:12:05 -0600
> Subject: Re: [Tutor] sftp using subprocess
>
> > On Dec 3, 2018, at 16:01, Asad <asad.hasan2...@gmail.com> 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
> da...@graniteweb.com
>
>
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: "Steven D'Aprano" <st...@pearwood.info>
> To: tutor@python.org
> Cc:
> Bcc:
> Date: Tue, 4 Dec 2018 11:12:56 +1100
> Subject: Re: [Tutor] sftp using subprocess
> On Tue, Dec 04, 2018 at 03:31:53AM +0530, Asad wrote:
>
> > however it gives error even unable to provide password .
>
> Is the error a secret? Would you like us to guess what it is?
>
>
> --
> Steve
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> https://mail.python.org/mailman/listinfo/tutor
>


-- 
Asad Hasan
+91 9582111698
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to