supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

timw.google tjandacw at yahoo.com
Tue Oct 9 17:06:04 CEST 2007


On Oct 7, 1:01 pm, Michael Torrie <torr... at chem.byu.edu> wrote:
> timw.google wrote:
> > Hi
>
> > I want to write a python script that runs rsync on a given directory
> > and host. I build the command line string, but when I try to run
> > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or
> > os.system(cmd), I get prompted for my login password. I expected this,
> > but when I try to give my password, it's echoed back to the terminal
> > and the special characters in the password is (I think) getting
> > interpreted by the shell (zsh)
>
> > I can't ssh w/o supplying a password. That's the way the security is
> > set up here.
>
> > How do I use python to do this, or do I just have to write a zsh
> > script?
>
> You need to use the pexpect module.
>
>
>
> > Thanks.

Thanks to all the suggestions on getting this to work w/ python. I'll
look into this more when I get the chance. I don't have root access,
so setting up some kind of server is out. I may not be able to try the
other suggestions either, as they have things locked down pretty tight
around here.




More information about the Python-list mailing list