backup system files (and permissions) over ssh

Wayne Davison wayned at samba.org
Thu Oct 12 22:33:57 GMT 2006


On Thu, Oct 12, 2006 at 12:19:14PM +0200, rsync-mail-gateway at nasbackup.com wrote:
> how do you backup system files like /etc/ over ssh to another machine
> and keep permissions the same on the remote backup location ?

One possibility you can try is to use a program that lets rsync pretend
to be root, such as fakeroot or pretendroot.  I have fakeroot here that
I've used for small tasks.  For instance:

  WHO=/backup/foo
  rsync -av --rsync-path="fakeroot -s $WHO.fake -i $WHO.fake -- rsync" \
      /local/ host:$WHO/

As long as you never change the files in /backup/foo without using
fakeroot, you should be fine.  E.g. if a user on host wants to change
something in /backup/foo, they would need to run fakeroot:

  cd /backup
  fakeroot -s foo.fake -i foo.fake    # starts a shell
  cd foo
  ...
  exit

The fakeroot command stores attributes for things that can't be done the
save file (foo.fake).  It doesn't appear to be a very efficient save
file, though, so you'd need to test how well it performs.  Also, it
doesn't appear to handle simultaneous updates at all.

..wayne..


More information about the rsync mailing list