Automate rsync w/ authentication

Piet van Oostrum piet at cs.uu.nl
Mon Jul 13 14:25:58 EDT 2009


>>>>> Bryan <bryanvick at gmail.com> (B) wrote:

>B> On Jul 10, 12:03 pm, mgi... at motorola.com (Gary Duzan) wrote:
>>> In article <3af970b1-b454-4d56-a33f-889ecfaca... at l28g2000vba.googlegroups.com>,
>>> 
>>> Bryan  <bryanv... at gmail.com> wrote:
>>> 
>>> >rsyncExec = '/usr/bin/ssh'
>>> >source = 'r... at 10.0.45.67:/home/bry/jquery.lookup'
>>> >dest = '/home/bry/tmp'
>>> >rshArg = '-e "/usr/bin/ssh -i /home/bry/keys/brybackup.key"'
>>> >args = [rsyncExec, '-a', '-v', '--dry-run', rshArg, source, dest]
>>> 
>>>    I think you want -e and the ssh command to be separate args.
>>> Something like:
>>> 
>>> rshArg = '/usr/bin/ssh -i /home/bry/keys/brybackup.key'
>>> args = [rsyncExec, '-a', '-v', '--dry-run', '-e', rshArg, source, dest]
>>> 
>>> or:
>>> 
>>> rshArgs = [ '-e', '/usr/bin/ssh -i /home/bry/keys/brybackup.key' ]
>>> args = [rsyncExec, '-a', '-v', '--dry-run'] +  rshArgs + [ source, dest]
>>> 
>>>                                         Gary Duzan
>>>                                         Motorola H&NM

>B> Separating the argument parts worked.  Strangely though, I don't need
>B> to do that for arguments such as --files-from='/path/to/file'.  Also,
>B> in this example code I had the rsync executable path pointing to the
>B> ssh program, so no wonder I was getting the output of ssh!

I should have seen that because I changed it in my own copy!!!

--files-from='/path/to/file *is* one argument, in contrast to 
-e "/usr/bin/ssh -i /home/bry/keys/brybackup.key" which is two
arguments.

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list