[Dirvish] Dirvish, rsync and sudo

Eric Mountain em-dirvish-1 at nerim.net
Wed Jul 13 13:40:58 PDT 2005


On Tuesday 12 Jul 2005 23:33, Eric Mountain spake thus:
> On Tuesday 12 Jul 2005 01:55, Brian Scanlan spake thus:
> > 3) Apply the following patch to dirvish:
> >
> > diff /usr/sbin/dirvish /tmp/dirvish.old
> >
> > 522c522
> > <       ( split(' ',$$Options{rsync}) ? split(' ',$$Options{rsync}) :
> > 'rsync'), ---
> >
> > >       ($$Options{rsync} ? $$Options{rsync} : 'rsync'),
> >
> > 4) Add the following lines to /etc/dirvish/master.conf
> > rsync: sudo rsync
> > rsync-client: sudo rsync
> >
> > This patch is required as dirvish will do a system("sudo rsync"...)
> > rather than system("sudo","rsync"...).
>
> In fact, I think you don't need that patch (and it would break people's
> current configs).
>
> Dirvish's config file syntax is a little bit special for list values.  Your
> config above (step 4) should in fact look like this:
>
> rsync:
>   sudo
>   rsync
> rsync-client:
>   sudo
>   rsync

Next time I will learn to RTFM, I promise.  rsync and rsync-client are of type 
S(tring), not L(ist) in the config file.

So... I was hoping rsync-option would solve the pb, but that doesn't work 
because it is not the first set of options added to the list after the sudo 
command.  i.e. I was hoping we could do:

rsync: sudo
rsync-client: sudo
rsync-option:
  rsync

[ yes, this is somewhat hackish, but it is not entirely bad form in that rsync 
becomes an option of sudo ]

To work, the above would require a change in the code.  The advantage is that 
it would be more transparent as it would not affect the way the config file 
is parsed.

OTOH, Ben Luey had a clean solution to this pb which was to wrap the sudo call 
inside a script:

> Ben Luey, 6th March 2005:
> Add the following line into the master.conf on the backup machine:
> 
> rsync-client: "/usr/local/bin/rsync-new"
> 
> On the computer to be backed up, create the script
> /usr/local/bin/rsync-new with content:
> 
> #!/bin/sh
> sudo /usr/bin/rsync $*

Cheers,
Eric
-- 
Eric Mountain


More information about the Dirvish mailing list