[Dirvish] Dirvish, rsync and sudo

Brian Scanlan brian.scanlan at gmail.com
Mon Jul 11 16:55:38 PDT 2005


I'm in the process of building a backup server running Dervish 1.2-1
from Debian Sarge, and I've got dirvish working with rsync running
through sudo, meaning that dirvish itself runs as a non-privileged
user, while maintaining user/group info and being able to backup

The following procedure works:
0) Pick/create a user on both clients and server, create and
distribute ssh key, ensure write permissions on bank etc.
1) Add the user to group root (so as to be able to run sudo... this
may be not be required on all systems) on both client and server
2) Add the following line into /etc/sudoers on both client and server 
username  ALL= (root) NOPASSWD: /usr/bin/rsync
3) Apply the following patch to dirvish:

diff /usr/sbin/dirvish /tmp/dirvish.old

<       ( 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"...).  The only problem is that the
find process afterwards will complain of not being able to read/write
the files. I can fix this by running find as root in the same manner
as rsync, however this will probably require a longer patch, so that
the path to find can also be got from the master.config file, and run
by sudo.
I realise that this does not cure all security problems, something has
to run as root and therefore can do damage, however minimising the
processes that run as root seems to follow the principal of "run as
little as root as possible". If there is a better way of achieving
this, please let me know, if not is it worth writing a larger patch
for inclusion in 1.4 that allows rsync and find to be both run via


More information about the Dirvish mailing list