[CentOS] Need help with rsync.

Tue May 20 16:50:58 UTC 2008
Bowie Bailey <Bowie_Bailey at BUC.com>

James B. Byrne wrote:
> I have two hosts which have their respective keys loaded into each
> others .ssh/authorized-keys2 file for root.  I want to move a
> directory tree from one host to the other via rsync to maintain a
> shadow structure of the application provided on the main host.
> 
> This is the relevant part of the command:
> 
> rsync -avz --rsh=ssh --delete-after /var/data/pas-redmine
> root at inet01.mississauga.harte-lyne.ca:/var/data
> 
> The connection is made and a good deal of material is successfully
> transferred. I am however getting a number of permission errors:
> 
> rsync: readlink "/var/data/pas-redmine/lib/tabular_form_builder.rb"
> failed: Permission denied (13)
> rsync: readlink "/var/data/pas-redmine/lib/redmine.rb" failed:
> Permission denied (13)
> rsync: readlink "/var/data/pas-redmine/lib/diff.rb" failed:
> Permission denied (13)
> 
> and many more:
> 
> 
> The permissions and owner for these are:
> -rw-r--r-- 1 pas pas 2341 May  9 13:57 \
>    /var/data/pas-redmine/lib/tabular_form_builder.rb
> -rw-r--r-- 1 pas pas 7934 May  9 13:57 \
>    /var/data/pas-redmine/lib/redmine.rb
> -rw-r--r-- 1 pas pas 5602 May  9 13:57 \
>    /var/data/pas-redmine/lib/diff.rb
> ...
> 
> 
> The host application directory structure is a checked out svn
> repository, but some of the files that are giving errors are created
> locally such as the database dump file.  I am at a loss to explain
> this since the rsync and ssh user, so far as I can tell, is root and
> this, so far as I understand, should allow unrestricted access to the
> files regardless of the ownership or permissions.
> 
> If someone can clue me in as to what I am misapprehending here I
> would be much appreciative.

Maybe you need to specify the uid and gid for rsyncd on the server.  If
it's defaulting to nobody, that could be your problem.

    uid    The "uid" option specifies the user name or user ID that file
           transfers to and from that module should take  place  as when
           the daemon  was run as root. In combination with the "gid"
           option this determines what file permissions are available.
           The default is uid -2, which is normally the user "nobody".

    gid    The "gid" option specifies the group name or group ID that
           file transfers to and from that module should take place as
           when the daemon was run as root. This complements the "uid"
           option. The default is gid -2, which is normally the group
           "nobody".

For one machine that I'm backing up via rsync, my /etc/rsyncd.conf looks
like this:

    [backup]
        path = /backupdir
        hosts allow = xx.xx.xx.xx
        auth users = alloweduser
        secrets file = /etc/rsyncd.secrets
        uid = 0
        gid = 0

-- 
Bowie